<html>
<head>
</head>
<body style="background: transparent;">
    <script src="scripts/docstrap.lib.js"></script>
    <script src="scripts/lunr.min.js"></script>
    <script src="scripts/fulltext-search.js"></script>

    <script type="text/x-docstrap-searchdb">
    {"najax.static.js.html":{"id":"najax.static.js.html","title":"Source: najax.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: najax.static.js 'use strict'; /** * $najax(any-ajax) static methods. Provide various ajax methods. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | scriptTag | Yes | - | * | jsonpTag | Yes | - | * | Others | Yes | Yes | * * &lt;b&gt;Requires&lt;/b&gt;&lt;br&gt; * Any other library is unnecessary. * &lt;small&gt;(Only $najax.sendex method requires &lt;i&gt;any.js&lt;/i&gt; and &lt;i&gt;jQuery&lt;/i&gt; library.)&lt;/small&gt; * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * - Specify ajax request and response behaviors by &lt;code&gt;Nx object&lt;/code&gt;. * - Specify by Nx object's various method or &lt;code&gt;Nx &lt;i&gt;opt&lt;/i&gt;&lt;/code&gt; method. * - Begin ajax connection by &lt;code&gt;Nx &lt;i&gt;done&lt;/i&gt;&lt;/code&gt;. * - &lt;code&gt;Nx &lt;i&gt;done&lt;/i&gt;&lt;/code&gt; returns &lt;code&gt;Relay object&lt;/code&gt;. * - &lt;code&gt;Relay&lt;/code&gt; provide operating response-data, and bundling multiple &lt;code&gt;Relay&lt;/code&gt;. * - &lt;code&gt;Nx&lt;/code&gt; implement ajax by using &lt;i&gt;XMLHttpRequest&lt;/i&gt;. * * @namespace $najax * * @see $najax.request * * @tutorial static-najax * * @example * $najax.request('path.php').done(); * $najax.request('path.php', {a1:1,a2:2,a3:3}).done(function(data){ ... }); * * $najax.post('path.php', {a:1, b:2, c:3}).done(); * $najax.post('path.php').param('a', 'A').param('b', 'B').done(); * $najax.raw('path.php').done(); * * $najax.html('template.htm').done(function(el){ ... }); * $najax.xml('xml.php').done(function(xml){ ... }); * $najax.jsonp('jsonp.php', jsp_func).done(); * $najax.sync('ajax.php').done(function(data){ ... }); * $najax.script('script.php').done(); * $najax.csv('list.csv').done(function(rows){ ... }); */ /** * Simple ajax request. It's possible to specify ajax behaviors by using Nx object's method chaining. * * @function request * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see $najax.get * @see $najax.post * * @see Nx * @see Relay * * @tutorial static-najax * * @example * $najax.request('path.php').done(); * $najax.request('path.php', {a1:1,a2:2,a3:3}).done(function(data){ ... }); * var nx = $najax.request('path.php');nx.param('a', 1).done(); * $najax.request('path.php').type('raw').done(); * $najax.request('path.php').success(function(){ ... }).fail(function(){ ... }).done(); * $najax.request('path.php').retry(2).done(); * $najax.request('path.php').async(false).timeout(30).done(); * $najax.request('path.php').header('certify', 'mycode').done(); * $najax.request('path.php').upload(element).done(); * $najax.request('path.php').running(function(v){ ... }).complete(function(){ ... }).done(); */ njx.request = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs); }; /** * GET ajax request. * @function get * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see Linker * @see $najax.request * @see $najax.post * * @tutorial static-najax * @example * $najax.get('path.php').done(); * $najax.get('path.php', {a1:1,a2:2,a3:3}).done(function(data){ ... }); */ njx.get = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).opt('method', 'GET'); }; /** * POST ajax request. * @function post * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * @see $najax.get * * @tutorial static-najax * @example * $najax.post('path.php', {a:1, b:2, c:3}).done(); * $najax.post('path.php').param('a', 'A').param('b', 'B').done(); * $najax.post('path.php', vs).done(function(data){ ... }); */ njx.post = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).opt('method', 'POST'); }; /** * Raw(text) response / ajax request. * @function raw * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.raw('path.php').done(); * $najax.raw('path.php', vs).done(function(data){ ... }); * $najax.raw('path.php', vs).success(function(raw){ ... }).done(); */ njx.raw = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).type('raw'); }; /** * Alias of $najax.raw. * @function text * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.text('path.php').done(); * $najax.text('path.php', vs).done(function(data){ ... }); * $najax.text('path.php').success(function(text){ ... }).done(); */ njx.text = function(url, vs, opt){ return njx.raw(url, vs, opt); }; /** * HTML response / ajax request. This method evaluate JavaScript in HTML. It's possible to specify root element by &lt;code&gt;element&lt;/code&gt; option in Nx. * * &lt;b&gt;Response value type&lt;/b&gt; &lt;code&gt;Element&lt;/code&gt; * * @function html * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @param {boolean} [opt.cache=true] Enable cache. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.html('template.htm').done(function(el){ ... }); //Response arg is Element. * $najax.html('template.php').success(function(el){ ... }).done(); * $najax.html('template.php').opt('element', 'span').(function(el){ ... }).done(); //root element tag. * $najax.html('template.php').opt('element', el).(function(el){ ... }).done(); //root element. */ njx.html = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).cache(true).type('html'); }; /** * Script execute / ajax request. It's possible to specify evaluate mode, &lt;i&gt;eval&lt;/i&gt; or &lt;i&gt;function&lt;/i&gt; by &lt;code&gt;iseval&lt;/code&gt; option in Nx. * * &lt;b&gt;Response value type&lt;/b&gt; &lt;code&gt;null&lt;/code&gt; * * @function script * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @param {boolean} [opt.cache=true] Enable cache. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.script('script.php').done(); * $najax.script('script.php').opt('iseval', false).done(); //by function. */ njx.script = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).cache(true).type('script'); }; /** * Function response / ajax request. This method don't execute script, pass &lt;i&gt;function object&lt;/i&gt; to argument. * * &lt;b&gt;Response value type&lt;/b&gt; &lt;code&gt;function&lt;/code&gt; * * @function func * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @param {boolean} [opt.cache=true] Enable cache. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.func('script.php').done(function(fn){ ... }); * $najax.func('script.php').success(function(fn){ ... }).done(); */ njx.func = function(url, vs, opt){ return (new Nx(opt)).__basic(url, vs).cache(true).type('func'); }; /** * XML response / ajax request. * * &lt;b&gt;Response value type&lt;/b&gt; &lt;code&gt;XMLDocument&lt;/code&gt; * * @function xml * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.xml('xml.php').done(function(xml){ ... }); * $najax.xml('xml.php', vs).done(function(xml){ ... }); * $najax.xml('xml.php').param({a:1, b:1, c:3}).done(function(xml){ ... }); */ njx.xml = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).type('xml'); }; /** * Jsonp / ajax request. It's possible to specify jsonp-callback function by &lt;code&gt;jsonp&lt;/code&gt; func in Nx. * * &lt;b&gt;Response value type&lt;/b&gt; &lt;code&gt;null&lt;/code&gt; * * @function jsonp * @memberof $najax * * @param {string} url URL. * @param {function|string} fn Callback function. It must be global function. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.jsonp('jsonp.php', jsp_func).done(); * $najax.jsonp('jsonp.php', 'jsp_func').done(); * $najax.jsonp('jsonp.php', jsp_func).method('post').done(); * $najax.jsonp('jsonp.php').jsonp(jsp_func, 'callback').param(vs).done(); */ njx.jsonp = function(url, fn, opt){ return (new Nx(opt)).__basic(url).jsonp(fn); }; /** * CSV(TSV) response / ajax request. It's possible to specify csv-separator by &lt;code&gt;separator&lt;/code&gt; option in Nx. * * &lt;b&gt;Response value type&lt;/b&gt; &lt;code&gt;Array&lt;/code&gt; * * @function csv * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.csv('list.csv').done(function(rows){ ... }); * $najax.csv('list.tsv').opt('separator', &quot;\\t&quot;).done(function(rows){ ... }); */ njx.csv = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).type('csv'); }; /** * Ajax request with synchronization mode. * * @function sync * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @returns {Nx} * * @see Nx * @see Relay * @see $najax.request * * @tutorial static-najax * @example * $najax.sync('ajax.php').done(function(data){ ... }); * var rl = $najax.sync('ajax.php').done(); * var v = rl.value(); */ njx.sync = function(url, vs, opt){ return (new Nx(opt)).__basic(url , vs).async(false); }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"common_base.js.html":{"id":"common_base.js.html","title":"Source: common_base.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: common_base.js 'use strict'; /** * $najax defines. * @namespace $najax.define */ njx.define = {}; /** * Error mode. * * &lt;b&gt;Value defines&lt;/b&gt;&lt;br&gt; * * | Value | Description | * |:---|:---| * | &lt;code&gt;0&lt;/code&gt; | none | * | &lt;code&gt;1&lt;/code&gt; | error | * | &lt;code&gt;2&lt;/code&gt; | error+trace | * * @name error * @memberof $najax.define * @type {number} * @default 1 * * @example * $najax.define.error = 2; */ njx.define.error = 1; //0:none, 1:error, 2:error+trace /** * @ignore */ function error(){ if ($najax.define.error &lt;= 0){ return; } console.error.apply(console, arguments); if ($najax.define.error == 2){ console.trace(); } } /** * Identifier for disabling cache. Used by $najax.request and other various methods. * @name utms * @memberof $najax.define * * @type {string} * @default '__utms' */ njx.define.utms = '__utms'; /** * Default relay-data mode. It's possible to take out value by &lt;i&gt;Relay&lt;/i&gt; object. Specify by 'Bitwise OR' value. * * &lt;b&gt;Value defines&lt;/b&gt;&lt;br&gt; * * | Value | Description | * |:---|:---| * | &lt;code&gt;1&lt;/code&gt; | Args of &lt;i&gt;complete&lt;/i&gt; function. Response value and XHR object. &lt;code&gt;rl.value()&lt;/code&gt; &lt;code&gt;rl.get()&lt;/code&gt; | * | &lt;code&gt;2&lt;/code&gt; | Original data. User original data, etc. | * | &lt;code&gt;4&lt;/code&gt; | Raw data. Ajax raw response. &lt;code&gt;rl.data('_raw')&lt;/code&gt; | * * @name relaymode * @memberof $najax.define * * @type {number} * @default 3 (args + original data) * * @example * $najax.define.relaymode = 1; //args. * $najax.define.relaymode = 3; //args + original data. * $najax.define.relaymode = 6; //original data and raw data. */ njx.define.relaymode = 3; //1: args, 2: original data, 4: raw data /** * Alert method for connection error. * @name failAlert * @memberof $najax.define * * @example * $najax.request(url).fail($najax.define.failAlert).done(); */ njx.define.failAlert = function(){ alert(njx.define.msg[1]); }; /** * @ignore */ function attr(c, w, v){ c.setAttribute(w ,v); } /** * @ignore */ function isEmp(vs){ if (!vs){ return true; } for (var k in vs){ if (vs.hasOwnProperty(k)){ return false; } } return true; } × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"default_najax-ex.static.js.html":{"id":"default_najax-ex.static.js.html","title":"Source: default/najax-ex.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: default/najax-ex.static.js 'use strict'; /** * Ajax request with verifying automatically and showing messages. * * &lt;b&gt;&lt;i&gt;Note! Not included in najax-tiny.js.&lt;/i&gt;&lt;/b&gt;&lt;br&gt; * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * @namespace $najax@ex * @tutorial najax-ex * * @example * $najax.send('path.php').done(); * $najax.send('path.php', null, {verify: $najax.define.verify}).done(); * $najax.send('path.php', null, {verify: function(v){ return (v.verify)?true:false; } }).done(); * * $najax.sendex('path.php').done(); * $najax.sendex('path.php', null, {verify: $najax.define.verify}).done(); */ /** * Response state defines. * @name state * @memberof $najax * @readonly * @enum {number} * * @see $najax.define.msg */ njx.state = { /** success. */ success: 0, /** connection error. */ ajax: 1, /** empty error. */ empty: 2, /** verify error. */ verify: 3, /** app error. */ app: 4 }; /** * Default messages for $najax.send / $najax.sendex. * @name msg * @memberof $najax.define * * @type {object} * @property {string} [0] Success. * @property {string} [1] Connection error(ajax). * @property {string} [2] Empty error(ajax). * @property {string} [3] Verify error(ajax). * @property {string} [4] App error(ajax). * * @see $najax.state * @see $najax@ex.send * @see $najax@ex.sendex * * @example * $najax.define.msg[0] = 'Success.'; */ njx.define.msg = { 0: 'Success.', 1: 'Connection error(ajax).', 2: 'Empty error(ajax).', 3: 'Verify error(ajax).', 4: 'App error(ajax).' }; /** * Default alert method for $najax.send. * @name fail * @memberof $najax.define * * @param {number} state Response state. See &lt;i&gt;$najax.state&lt;/i&gt;. * @param {string} msg Message. See &lt;i&gt;$najax.define.msg&lt;/i&gt;. * @param {*} v Response value. * * @see $najax.state * @see $najax.define.msg * * @see $najax@ex.send * * @example * $najax.define.fail = function(state, msg, v){ * alert(msg); * }; */ njx.define.fail = function(state, msg, v){ alert(msg); }; /** * Default verify method for $najax.send / $najax.sendex. * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(v){ return (v.result == 1); }&lt;/code&gt; * * @name verify * @memberof $najax.define * * @param {*} v Response value. * @return {boolean} * * @see $najax@ex.send * @see $najax@ex.sendex * * @example * $najax.define.verify = function(v){ * return (v.result == 1); * }; */ njx.define.verify = function(v){ return (v.result == 1); }; /** * Default success-message method for $najax.sendex. * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * Show message by &lt;i&gt;$any.floating.msg&lt;/i&gt; * * @name successex * @memberof $najax.define * * @param {string} msg Message. See &lt;i&gt;$najax.define.msg&lt;/i&gt;. * @param {*} v Response value. * * @see $najax.define.msg * @see $najax@ex.sendex * * @example * $najax.define.successex = function(msg, v){ * $any.floating.msg(msg); * } */ njx.define.successex = function(msg, v){ $any.floating.msg(msg); }; /** * Default fail-message method for $najax.sendex. * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * Show message by &lt;i&gt;$any.floating.msg&lt;/i&gt; * * @name failex * @memberof $najax.define * * @param {string} msg Message. See &lt;i&gt;$najax.define.msg&lt;/i&gt;. * @param {*} v Response value. * * @see $najax.define.msg * @see $najax@ex.sendex * * @example * $najax.define.failex = function(type, msg, v){ * $any.floating.msg(msg, null, {css: 'error'}); * } */ njx.define.failex = function(type, msg, v){ $any.floating.msg(msg, null, {css: 'error'}); }; /** * @ignore */ function sdMsg(v, xhr, r, o){ var tp = 0; if (xhr.status != 200){ tp = njx.state.ajax; }else if (!v){ tp = njx.state.empty; }else if (o.verify &amp;&amp; !o.verify(v)){ tp = njx.state.verify; }else if (r === false){ tp = njx.state.app; } if (tp == 0){ if (o.success){ o.success(o.msg[tp], v); } }else{ if (o.fail){ o.fail(tp, o.msg[tp], v); } } } /** * Simple ajax request with verifying automatically and showing messages. * * @function send * @memberof $najax@ex * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @param {function} [opt.success=null] Success function. * @param {function} [opt.fail=$najax.define.fail] Fail function. * @param {function} [opt.verify=null] Verify function. If null, not verify. &lt;code&gt;Ex: {verify: $najax.define.verify}&lt;/code&gt; * @param {assoc} [opt.msg=$najax.define.msg] Messages. * @returns {Nx} * * @see $najax.define.fail * @see $najax.define.verify * @see $najax.define.msg * @see $najax.request * * @tutorial najax-ex * @example * $najax.send('path.php').done(); * $najax.send('path.php', null, {verify: $najax.define.verify}).done(); * $najax.send('path.php', null, {verify: function(v){ return (v.verify)?true:false; } }).done(); * $najax.send('path.php', null, {msg: {0: 'OK', 4: 'Application error!!'} }).done(); */ njx.send = function(url, vs, opt){ opt = ext(ext({}, { success: null, fail: njx.define.fail, verify: null, msg: njx.define.msg }, true), opt, true); return njx.request(url, vs, opt).__set('__after', function(v, xhr, r){ sdMsg(v, xhr, r, opt); }); }; /** * Ajax request with verifying automatically and showing messages by $any.floating.msg, showing loading message. * * &lt;b&gt;Requires&lt;/b&gt;&lt;br&gt; * jQuery / any.js * * @function sendex * @memberof $najax@ex * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET / POST. * @param {assoc} [opt] Nx options. * @param {function} [opt.success=$najax.define.successex] Success function. * @param {function} [opt.fail=$najax.define.failex] Fail function. * @param {function} [opt.verify=null] Verify function. If null, not verify. &lt;code&gt;Ex: {verify: $najax.define.verify}&lt;/code&gt; * @param {assoc} [opt.msg=$najax.define.msg] Messages. * @param {string} [opt.loading='loading'] Loading CSS name. * @returns {Nx} * * @see $najax.define.successex * @see $najax.define.failex * @see $najax.define.verify * @see $najax.define.msg * @see $najax@ex.send * @see $najax.request * * @tutorial najax-ex * @example * $najax.sendex('path.php').done(); * $najax.sendex('path.php', null, {verify: $najax.define.verify}).done(); * $najax.sendex('path.php', null, {verify: function(v){ return (v.verify)?true:false; } }).done(); * $najax.sendex('path.php', null, {msg: {0: 'OK', 4: 'Application error!!'} }).done(); */ njx.sendex = function(url, vs, opt){ opt = ext(ext({}, { success: njx.define.successex, fail: njx.define.failex, verify: null, msg: njx.define.msg, loading: 'loading' }, true), opt); return njx.send(url, vs, opt).__set('__before', function(){ $any.floating.loading(true, {css: opt.loading}); }).__set('__after', function(v, xhr, r){ $any.floating.loading(false); sdMsg(v, xhr, r, opt); opt = null; }); }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"default_history.static.js.html":{"id":"default_history.static.js.html","title":"Source: default/history.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: default/history.static.js 'use strict'; /** * Support history push and replace, listen. * * &lt;b&gt;&lt;i&gt;Note! Not included in najax-tiny.js.&lt;/i&gt;&lt;/b&gt;&lt;br&gt; * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * @namespace $najax.history * * @tutorial static-history * * @example * //push * $najax.history.push('?v=1'); * $najax.history.push('?v=1', null, 'abc'); * $najax.history.pushQuery(); * * //replace * $najax.history.replace('?v=1'); * $najax.history.replace('?v=1', null, 'abc', {data: {v: 2}}); * $najax.history.replaceQuery('abc', {v: 2}); * * //listen * $najax.history.listen(function(e, id, vs, title){ ... }); * * //init * $najax.history.replaceListen(function(e, id, vs, title){ ... }); */ njx.history = {}; /** * @ignore */ var hsRpl = false; var hsLtn = false; /** * Push new page's url and title, values. Recommend to use this method with &lt;i&gt;$najax.history.listen&lt;/i&gt;. * @function push * @memberof $najax.history * * @param {string} url URL. * @param {string|integer} [id=null] Page's id. * @param {string} [title=null] Title. * @param {assoc} [opt] Options. * @param {assoc} [opt.data=null] Passed values. * @param {assoc} [opt.store=true] Store first page's data by &lt;i&gt;$najax.history.replace&lt;/i&gt;. * @param {function} [opt.legacy=null] Legacy browser's behaviors. &lt;code&gt;Ex: function(url, title, vs){location.href = url;}&lt;/code&gt; * * @see $najax.history.pushQuery * * @tutorial static-history * * @example * $najax.history.push('?v=1'); * $najax.history.push('?v=1', id, 'abc', {data: {v: 2}}); * $najax.history.push('?v=1', null, null, {legacy: function(url, id, title, vs){ ... } }); */ njx.history.push = function(url, id, title, opt){ opt = ext({data:null, store: true, legacy: null}, opt); id = (id !== undefined)?id:null; title = (title !== undefined)?title:null; if (history.pushState){ if (opt.store &amp;&amp; !hsRpl){ njx.history.replace(); } history.pushState({id: id, title: title, data: opt.data}, title, url); }else{ if (opt.legacy){ opt.legacy.call(null, url, id, title, opt.data); } } }; /** * Push new page's url and title, values. Support query-string. Recommend to use this with &lt;i&gt;$najax.history.listen&lt;/i&gt;. * @function pushQuery * @memberof $najax.history * * @param {string|integer} [id=null] Page's id. * @param {string} [title=null] Title. If null, set now title. * @param {assoc} [vs=null] Passed values. URL's query-string values is overrided by this values. * @param {assoc} [opt] Options. $najax.history.push options. * * @see $najax.history.pushQuery * * @tutorial static-history * * @example * $najax.history.pushQuery(); * $najax.history.pushQuery(id, 'abc', vs, {data: {v: 2}}); * $najax.history.pushQuery(null, 'abc', null, {title: false}); */ njx.history.pushQuery = function(id, title, vs, opt){ var u = njx.url(location.href, vs); njx.history.push(u, id, title, vs, opt); }; /** * Replace now page's url and title, values. * @function replace * @memberof $najax.history * * @param {string} [url] URL. If null, prepare now url. * @param {string|integer} [id=null] Page's id. * @param {string} [title=null] Title. If null, set now title. * @param {assoc} [opt] Options. * @param {assoc} [opt.data=null] Passed values. * @param {function} [opt.legacy=null] Legacy browser's behaviors. &lt;code&gt;Ex: function(url, title, vs){location.replace = url;}&lt;/code&gt; * * @see $najax.history.replaceQuery * * @tutorial static-history * * @example * $najax.history.replace('?v=1'); * $najax.history.replace('?v=1', id, 'abc', {data: {v: 2}}); * $najax.history.replace('?v=1', null, null, {legacy: function(url, id, title, vs){ ... } }); */ njx.history.replace = function(url, id, title, opt){ opt = ext({data:null, legacy: null}, opt); hsRpl = true; if (url == null){ url = location.href; } if (title == null){ title = document.title; } if (history.pushState){ history.replaceState({id: id, title: title, data: opt.data}, title, url); }else{ if (opt.legacy){ opt.legacy.call(null, url, id, title, opt.data); } } }; /** * Replace now page's url and title, values. Support query-string. * @function replaceQuery * @memberof $najax.history * * @param {string|integer} [id=null] Page's id. * @param {string} [title=null] Title. If null, set now title. * @param {assoc} [vs=null] Passed values. URL's query-string values is overrided by this values. * @param {assoc} [opt] Options. $najax.history.replace options. * * @see $najax.history.replace * * @tutorial static-history * * @example * $najax.history.replaceQuery(); * $najax.history.replaceQuery(id, 'abc', vs, {data: {v: 2}}); * $najax.history.replaceQuery(null, 'abc', null, {title: false}); */ njx.history.replaceQuery = function(id, title, vs, opt){ var u = njx.url(location.href, vs); njx.history.replace(u, id, title, vs, opt); }; /** * Listen to event of browser's back and prev. * @function listen * @memberof $najax.history * * @param {function} fn Callback function. &lt;code&gt;function(e:event, title:string, vs:assoc){ ... }&lt;/code&gt; * @param {assoc} [opt] Options. * @param {boolean} [opt.title=true] Change title automatically. * * @tutorial static-history * * @example * $najax.history.listen(function(e, id, title, data){ ... }); */ njx.history.listen = function(fn, opt){ opt = ext({title: true}, opt); hsLtn = true; if (history.pushState){ window.onpopstate = function(e){ var id=null, title=null, data=null; if (e.state){ id = e.state.id || null; title = e.state.title || null; data = e.state.data || null; } if (fn){ fn.call(null, e, id, title, data); } if (opt.title &amp;&amp; title != null){ document.title = title; } }; } }; /** * Replace &amp; replace now. * @function init * @memberof $najax.history * * @param {function} fn Callback function. &lt;code&gt;function(e:event, title:string, vs:assoc){ ... }&lt;/code&gt; * @param {string|integer} [id=null] Page's id. * @param {string} [title=null] Title. * @param {assoc} [opt] Options. &lt;i&gt;$najax.history.listen, $najax.history.replace&lt;/i&gt;'s options. * @param {assoc} [opt.data=null] Passed values. * * @tutorial static-history * * @example * $najax.history.replaceListen(function(e, id, title, data){ ... }, id); */ njx.history.replaceListen = function(fn, id, title, opt){ opt = ext({data: null}, opt); njx.history.listen(fn, opt); njx.history.replace(null, id, title, opt); }; /** * Get &lt;i&gt;history.state&lt;/i&gt;. * @function state * @memberof $najax.history * @returns {assoc} * * @tutorial static-history * * @example * vs = $najax.history.state(); */ njx.history.state = function(){ return history.state || null; }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"default_najax-core-tag.js.html":{"id":"default_najax-core-tag.js.html","title":"Source: default/najax-core-tag.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: default/najax-core-tag.js 'use strict'; /* global mkURL: false */ /* global argPss: false */ /* global preRl: false */ /** * Tx class. This class is created automatically by $najax.scriptTag and $najax.jsonpTag. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * - Specify load and response behaviors by &lt;code&gt;Nx object&lt;/code&gt;. * - Specify by Tx object's various method or &lt;code&gt;Tx &lt;i&gt;opt&lt;/i&gt;&lt;/code&gt; method. * - Begin tag-loading by &lt;code&gt;Tx &lt;i&gt;done&lt;/i&gt;&lt;/code&gt;. * - &lt;code&gt;Tx &lt;i&gt;done&lt;/i&gt;&lt;/code&gt; returns &lt;code&gt;Relay object&lt;/code&gt;. * - &lt;code&gt;Relay&lt;/code&gt; provide operating response-data, and bundling multiple &lt;code&gt;Relay&lt;/code&gt;. * - &lt;code&gt;Tx&lt;/code&gt; implement tag-loading by appending &lt;i&gt;SCRIPT tag&lt;/i&gt; element. * * @class Tx * * @param {assoc} [opt] Tx options. * @param {string} [opt.type='script'] Response type. * @param {boolean} [opt.cache=false] Enable cache. * @param {number} [opt.retry=null] Retry number. * @param {boolean} [opt.noescape=false] If true, not escape parameters. Apply to GET parameters. * @param {assoc} [opt.jsonp] Jsonp option. * @param {string|function} [opt.jsonp.callback=''] Jsonp callback function. * @param {string} [opt.jsonp.name='callback'] Jsonp callback variable name. * @param {string} [opt.mime='text/javascript'] Script tag's &lt;i&gt;type&lt;/i&gt;. * @param {string} [opt.charset=null] Script tag's &lt;i&gt;charset&lt;/i&gt;. * @param {number} [opt.relaymode=$najax.define.relaymode] Data relaymode. See $najax.define.relaymode for detail. * @param {boolean} [opt.clean=true] Clear object's values after completed. * * @see $najax.scriptTag * @see $najax.jsonpTag * * @tutorial static-najax * * @example * $najax.scriptTag(url).done(); * $najax.jsonpTag(url, 'func').done(); * * $najax.scriptTag(url).param('a', 1).param('b', 1).done(); * $najax.jsonpTag(url).jsonp('func').done(); * * $najax.scriptTag(url).opt({charset: 'utf-8'}).done(); * $najax.scriptTag(url).complete(function(){ ... }).done(); * $najax.scriptTag(url).fail(function(){ ... }).done(); */ var Tx = function(opt){ this._url = null; this._vs = null; this._relaydata = null; this._o = ext({ type: 'script', cache: false, retry: null, noescape: false, jsonp: {name: 'callback', callback: ''}, mime: 'text/javascript', charset: null, relaymode: njx.define.relaymode, clean: true }, opt); this._begin = null; this._running = null; this._sccs = null; this._fail = null; this._cmpl = null; this.__url = null; this.__retry = 0; this.__before = null; this.__after = null; this.__el = null; }; /** * Set url. * @function * @name url * @memberof Tx * @instance * * @param {string} url URL. * @returns {Tx} * * @tutorial static-najax * * @example * $najax.scriptTag(null).url(url).done(); */ /** * Set param. GET parameters. * @function * @name param * @memberof Tx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Tx} * * @tutorial static-najax * * @example * $najax.scriptTag(url).param('a', 1).param('b', 1).done(); * $najax.scriptTag(url).param({a: 1, b:2, c:3}).done(); */ /** * Set cache behavior. * @function * @name cache * @memberof Tx * @instance * * @param {boolean} on Determine to cache. * @returns {Tx} * * @default false * * @tutorial static-najax * * @example * $najax.scriptTag(url).cache(true).done(); */ /** * Set retry number. * @function * @name retry * @memberof Tx * @instance * * @param {number} n Retry number. * @returns {Tx} * * @default null * * @tutorial static-najax * * @example * $najax.scriptTag(url).retry(2).done(); */ /** * Set jsonp option. * @function * @name jsonp * @memberof Tx * @instance * * @param {string|function} [callback] Jsonp callback function. * @param {string} [name='callback'] Jsonp callback variable name. * @returns {Tx} * * @tutorial static-najax * * @example * $najax.jsonpTag(url).jsonp('func').done(); * $najax.jsonpTag(url).jsonp(func).done(); * $najax.jsonpTag(url).jsonp(func, 'callback').done(); */ /** * Set &lt;i&gt;charset&lt;/i&gt; value of script-tag. * @memberof Tx * @instance * * @param {string} v Charset. * @returns {Tx} * * @default null * * @tutorial static-najax * * @example * $najax.scriptTag(url).charset('utf-8').done(); */ Tx.prototype.charset = function(v){ this._o.charset = v; return this; }; /** * Set &lt;i&gt;type&lt;/i&gt; value of script-tag. * @memberof Tx * @instance * * @param {string} v Type. * @returns {Tx} * * @default 'text/javascript' * * @tutorial static-najax * * @example * $najax.scriptTag(url).mime('application/javascript').done(); */ Tx.prototype.mime = function(v){ this._o.mime = v; return this; }; /** * Set clear behavior. * @function * @name clean * @memberof Tx * @instance * * @param {boolean} on Determine to clear. If true, clear object's values after completed. * @returns {Tx} * * @default true * * @see Nx#clear * @tutorial static-najax * * @example * var tx = $najax.scriptTag(url).clean(false);tx.done(); */ /** * Set relay original data. * @function * @name relay * @memberof Tx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Tx} * * @tutorial static-najax * * @example * $najax.scriptTag(url).relay('a', 1).relay('b', 2).done(); * $najax.scriptTag(url).relay({a:1, b:2}).done(); */ /** * Set &lt;i&gt;opt&lt;/i&gt; value. * @function * @name opt * @memberof Tx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Tx} * * @tutorial static-najax * * @example * $najax.scriptTag(url).opt('noescape', true).done(); * $najax.scriptTag(url).opt('relaymode', 1).done(); * $najax.scriptTag(url).opt({charset: 'utf-8'}).done(); */ /** * Set begin function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called before beginning tag-loading. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name begin * @memberof Tx * @instance * * @param {function} fn Begin function. * @returns {Tx} * * @see Tx#success * @see Tx#fail * @see Tx#complete * @see Tx#running * @see Tx#done * * @tutorial static-najax * * @example * $najax.scriptTag(url).begin(function(){ ... }).done(); */ /** * Set success function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called when tag-loading succeed. ex: HTTP code 200. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name success * @memberof Tx * @instance * * @param {function} fn Success function. * @returns {Tx} * * @see Tx#begin * @see Tx#fail * @see Tx#complete * @see Tx#running * @see Tx#done * * @tutorial static-najax * * @example * $najax.scriptTag(url).success(function(){ ... }).done(); */ /** * Set fail function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called when tag-loading fail. ex: network error, 403, 404, 503 or any other HTTP error. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name fail * @memberof Tx * @instance * * @param {function} fn Fail function. * @returns {Tx} * * @see Tx#begin * @see Tx#success * @see Tx#complete * @see Tx#running * @see Tx#done * * @tutorial static-najax * * @example * $najax.scriptTag(url).fail(function(){ ... }).done(); */ /** * Set complete function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called after ajax completed, both success and fail. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name complete * @memberof Tx * @instance * * @param {function} fn Complete function. * @returns {Tx} * * @see Tx#begin * @see Tx#success * @see Tx#fail * @see Tx#running * @see Tx#done * * @tutorial static-najax * * @example * $najax.scriptTag(url).complete(function(){ ... }).done(); */ /** * Set running function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called when begin(state=true) and complete(state=false). * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(state:boolean){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name running * @memberof Tx * @instance * * @param {function} fn Running function. * @returns {Tx} * * @see Tx#begin * @see Tx#success * @see Tx#fail * @see Tx#complete * @see Tx#done * * @tutorial static-najax * * @example * $najax.scriptTag(url).running(function(state){ ... }).done(); */ /** * Set success / fail / complete, and begin tag-loading. * @memberof Tx * @instance * * @param {function} [success] Success function. See &lt;i&gt;Tx.success&lt;/i&gt;. * @param {function} [fail] Fail function. See &lt;i&gt;Tx.fail&lt;/i&gt;. * @param {function} [complete] Complete function. See &lt;i&gt;Tx.complete&lt;/i&gt;. * @returns {Relay} Relay object. * * @see Tx#begin * @see Tx#success * @see Tx#fail * @see Tx#complete * @see Tx#running * * @tutorial static-najax * * @example * $najax.scriptTag(url).done(); * $najax.scriptTag(url).done(function{ ... }); * $najax.jsonpTag(url, 'func').done(null, function{ ... }); * $najax.jsonpTag(url, 'func').done(null, null, function{ ... }); */ Tx.prototype.done = function(success, fail, complete){ this.__done(success, fail, complete); var rl = new Relay(); mkURL(this); preRl(this, rl); this.__start(rl); txReady(this, rl); return rl; }; /** * Abort ajax. * @memberof Tx * @instance * * @returns {Tx} * * @tutorial static-najax * * @example * tx.abort(); */ Tx.prototype.abort = function(){ if (window.stop){ window.stop(); } txDrop(this); return this; }; /** * Clear object's values after completed. * @memberof Tx * @instance * * @tutorial static-najax * * @example * tx.clear(); */ Tx.prototype.clear = function(){ txDrop(this); clear(this); }; ext(Tx.prototype, Bx); function txDrop(tx){ if (tx.__el){ tx.__el.onreadystatechange = tx.__el.onload = tx.__el.onerror = none; tx.__el.parentNode.removeChild(tx.__el); tx.__el = null; } } function txSc(tx, rl){ var r = null; if (tx._sccs){ r = tx._sccs(); } tx.__end(rl, null, r); rl.notifySuccess(); if (tx._o.clean){ tx.clear(); } } function txReady(tx, rl){ var c = document.createElement('script'); c.src = tx.__url; c.type = tx._o.mime; c.async = true; if (tx._o.charset){ c.charset = tx._o.charset; } tx.__el = c; if (document.head){ tx.__el.onload = function(){ txSc(tx, rl); tx = rl = null; }; tx.__el.onerror = function(){ var r = null; if (tx._o.retry &amp;&amp; tx._o.retry &gt; tx.__retry){ tx.__retry++; txDrop(tx); txReady(tx, rl); return; } if (tx._fail){ r = tx._fail(); } tx.__end(rl, null, r); rl.notifyFail(); if (tx._o.clean){ tx.clear(); } tx = rl = null; }; }else{ tx.__el.onreadystatechange = function(){ if (this.readyState === 'loaded'){ txSc(tx, rl); tx = rl = null; } }; } (document.head || document.body).appendChild(tx.__el); } Bx = null; /** * Script execute / tag request. Support outer cross-domain request. Only GET method. * * &lt;b&gt;&lt;i&gt;Note! Not included in najax-tiny.js.&lt;/i&gt;&lt;/b&gt;&lt;br&gt; * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * - Append &lt;i&gt;SCRIPT&lt;/i&gt; tag. * - Load script and execute script. * - Remove &lt;i&gt;SCRIPT&lt;/i&gt; tag. * * @function scriptTag * @memberof $najax * * @param {string} url URL. * @param {assoc} [vs=null] Parameters for GET. * @param {assoc} [opt] Tx options. * @returns {Tx} * * @see Tx * @see Relay * * @tutorial static-najax * @example * $najax.scriptTag('script.php').done(); * $najax.scriptTag('script.php', vs).done(); * $najax.scriptTag('script.php').charset('utf-8').done(); * $najax.scriptTag('script.php').success(function(){ ... }).done(); */ njx.scriptTag = function(url, vs, opt){ return (new Tx(opt)).__basic(url, vs, 'script'); }; /** * Jsonp / tag request. Support outer cross-domain request. Only GET method. * * &lt;b&gt;&lt;i&gt;Note! Not included in najax-tiny.js.&lt;/i&gt;&lt;/b&gt;&lt;br&gt; * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * See $najax.scriptTag specification. * * @function jsonpTag * @memberof $najax * * @param {string} url URL. * @param {function|string} fn Callback function. It must be global function. * @param {assoc} [opt] Tx options. * @returns {Tx} * * @see Tx * @see Relay * * @tutorial static-najax * @example * $najax.jsonpTag('script.php', jsp_func).done(); * $najax.jsonpTag('script.php', 'jsp_func').charset('utf-8').done(); * $najax.jsonpTag('script.php').jsonp(jsp_func, 'callback').done(); * $najax.jsonpTag('script.php').param(vs).done(); * $najax.jsonpTag('script.php').success(function(){ ... }).done(); */ njx.jsonpTag = function(url, fn, opt){ return (new Tx(opt)).__basic(url, null, 'jsonp').jsonp(fn); }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"default_najax-class.static.js.html":{"id":"default_najax-class.static.js.html","title":"Source: default/najax-class.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: default/najax-class.static.js 'use strict'; /** * $najax helper class. * * &lt;b&gt;&lt;i&gt;Note! Not included in najax-tiny.js.&lt;/i&gt;&lt;/b&gt;&lt;br&gt; * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * @namespace $najax@class * * @tutorial najax-class * @tutorial demo-ui-ajax * * @see Singular * @see Pager * @see Reflector * * @example * var Singular = $najax.Singular(); * * var Pager = $najax.Pager(); * * var Reflector = $najax.Reflector(); */ /** * RESTful class. * * @class RESTful */ var RESTful = function(url){ this.url(url); this._error = null; this._header = {}; }; ext(RESTful.prototype, { index: function(){ return this._prepare($najax.request(this._url + '/')); }, create: function(vs){ return this._prepare($najax.request(this._url + '/', vs).opt('method', 'POST')); }, show: function(id){ return this._prepare($najax.request(this._url + '/' + id + '/')); }, update: function(id, vs){ return this._prepare($najax.request(this._url + '/' + id + '/', vs).opt('method', 'PUT')); }, destroy: function(id){ return this._prepare($najax.request(this._url + '/' + id + '/').opt('method', 'DELETE')); }, url: function(v){ if (v) { v = v.replace(/\\/$/, ''); this._url = v; } return this; }, error: function(fn){ this._error = fn; return this; }, headers: function(vs){ this._header = vs; return this; }, _prepare: function(o){ if (this._error) { o.fail(this._error); } if (this._header){ o.header(this._header); } return o; } }); /** * RESTful-class builder. * * @function RESTful * @memberof $najax@class * @returns {RESTful} RESTful class. * * @see RESTful * * @tutorial najax-class * @tutorial demo-ui-ajax * */ njx.RESTful = function(){ return RESTful; }; /** * Singular class. Provide single-access. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * @class Singular * * @param {function} [caller] Caller function. * @param {function} [error] Error function. * * @see $najax@class.Singular * @see Relay * * @tutorial najax-class * @tutorial demo-ui-ajax * * @example * var Singular = $najax.Singular(); * var singular = new Singular(); * * single.caller(function(){ ... return rl; }); //Set caller. * single.kick(); //Begin. * btn.onclick = single.kicker(); //Begin. */ var Singular = function(caller, error){ this._run = false; this._caller = caller; this._error = error; }; ext(Singular.prototype, { /** * Kick method for bind. * @function * @name kick * @memberof Singular * @instance * * @tutorial najax-class * * @example * singular.kick(); */ kick: function(){ if (this._run){ if (this._error){ this._error.apply(this, arguments); } return; }else{ this._run = true; } var rl = this._caller.apply(this, arguments); njx.linker(rl).done(bind(this, function(){ this._run = false; })); }, /** * Return &lt;i&gt;kick&lt;/i&gt; method for bind. &lt;i&gt;this&lt;/i&gt; in &lt;i&gt;kick&lt;/i&gt; method is Singular object. * @function * @name kicker * @memberof Singular * @instance * * @returns {function} &lt;i&gt;kick&lt;/i&gt; method. * * @tutorial najax-class * * @example * btn.onclick = singular.kicker(); */ kicker: function(){ return bind(this, this.kick); }, /** * Set caller function. The caller function must returns &lt;code&gt;Relay object&lt;/code&gt;. * * &lt;b&gt;Function specification&lt;/b&gt; * &lt;code&gt;function(any:*){ ... return {Relay}; }&lt;/code&gt; * * @function * @name caller * @memberof Singular * @instance * * @param {function} fn Caller function. &lt;code&gt;function(any:*){ ... return {Relay}; }&lt;/code&gt; * * @see Relay * @tutorial najax-class * * @example * singular.caller(fn); * singular.caller(function(){ return $najax.request(url).done(function(data){ ... }); }); */ caller: function(fn){ this._caller = fn; }, /** * Set error function. * @function * @name error * @memberof Singular * @instance * * @param {function} fn Error function. * * @tutorial najax-class * * @example * singular.error(fn); */ error: function(fn){ this._error = fn; } }); /** * Singular class builder. * * @function Singular * @memberof $najax@class * * @returns {Singular} Singular class. * * @see Singular * * @tutorial najax-class * @tutorial demo-ui-ajax * * @example * var Singular = $najax.Singular(); * var singular = new Singular(); * * single.caller(function(){ ... return rl; }); Set caller. * single.kick(); //Begin. * btn.onclick = single.kicker(); //Begin. */ njx.Singular = function(){ return Singular; }; /** * Pager class. Provide paging methods. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * @class Pager * * @param {function} [fn] Callback function. * @param {number} [len] Item length. * @param {assoc} [opt] Option. * @param {string} [opt.n='n'] Variable name of page number. * @param {string} [opt.len='len'] Variable name of item length. * @param {string} [opt.all='all'] Variable name of all item length. * * @see $najax@class.Pager * * @tutorial najax-class * @tutorial demo-ui-ajax * * @example * var Pager = $najax.Pager(); * var pager = new Pager(function(n, len){... $najax.get('send.php', {n: n, len: len}) ... }); * var pager = new Pager(null, null, {n: 'pg'}); * * pager.len(15); //set length of page's items * pager.current(); //current * pager.move(5); //move * pager.prev(); //prev * pager.next(); //next * pager.data(); //get data * pager.data({all: 100, n:1}); //set data * pager.func(fn); //set function */ var Pager = function(fn, len, opt){ this._filter = fn || null; this._len = null; this.len(len); this._opt = ext({n:'n', len:'len', all:'all'}, opt); this._n = 1; this._all = -1; this._max = -1; }; ext(Pager.prototype, { /** * Set item-length or get item-length. * @function * @name len * @memberof Pager * @instance * * @param {number} [v] Item length. * @returns {void|number} * * @tutorial najax-class * * @example * pager.len(v); * len = pager.len(); */ len: function(v){ if (v === undefined){ return this._len; } this._len = v || 10; }, /** * Current. * @function * @name current * @memberof Pager * @instance * * @tutorial najax-class * * @example * pager.current(); */ current: function(){ this.__up(); }, /** * Move. * @function * @name move * @memberof Pager * @instance * * @param {number} [v] Page number. * * @tutorial najax-class * * @example * pager.move(v); */ move: function(v){ this._n = v; this.__up(); }, /** * Previous. * @function * @name prev * @memberof Pager * @instance * * @tutorial najax-class * * @example * pager.prev(); */ prev: function(){ this._n--; this.__up(); }, /** * Next. * @function * @name next * @memberof Pager * @instance * * @tutorial najax-class * * @example * pager.next(); */ next: function(){ this._n++; this.__up(); }, /** * Set data or get data. * @function * @name data * @memberof Pager * @instance * * @param {assoc} [data] Data. &lt;code&gt;{n:n, len:len, all: all}&lt;/code&gt; * @returns {void|assoc} &lt;b&gt;assoc&lt;/b&gt; {n:n, len:len, all: all, max: max} * * @tutorial najax-class * * @example * pager.data(data); * data = pager.data(); */ data: function(data){ if (data == null){ return {n:this._n, len:this._len, all:this._all, max: this._max}; } if (data[this._opt.n]){ this._n = data[this._opt.n]; } if (data[this._opt.len]){ this._len = data[this._opt.len]; } if (data[this._opt.all]){ this._all = data[this._opt.all]; } this.update(); }, /** * Set function. * @function * @name func * @memberof Pager * @instance * * @param {function} fn Function. * * @tutorial najax-class * * @example * pager.func(fn); */ func: function(fn){ this._filter = fn; }, /** * Update state. * @function * @name update * @memberof Pager * @instance * * @tutorial najax-class * * @example * pager.update(); */ update: function(){ this._n = (this._n &lt; 1)?1:this._n; if (this._all &gt; 0){ this._max = Math.ceil(this._all/this._len); this._n = (this._n &gt; this._max)?this._max:this._n; } }, /** * @ignore */ __up: function(){ this.update(); this._filter(this._n, this._len); } }); /** * Pager-class builder. * * @function Pager * @memberof $najax@class * @returns {Pager} Pager class. * * @see Pager * * @tutorial najax-class * * @example * var Pager = $najax.Pager(); * var pager = new Pager(function(n, len){... $najax.get('send.php', {n: n, len: len}) ... }); * * pager.len(15); //set length of page's items * pager.current(); //current * pager.move(5); //move * pager.prev(); //prev * pager.next(); //next * pager.data(); //get data * pager.data({all: 100, n:1}); //set data * pager.func(fn); //set function */ njx.Pager = function(){ return Pager; }; /** * Reflector class. Provide ajax request and reflect to content. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | - | * * @class Reflector * * @param {Nx} [nx=null] Nx object. If null, Create &lt;i&gt;Nx object&lt;/i&gt; automatically. * * @see $najax@class.Reflector * * @tutorial najax-class * @tutorial demo-ui-ajax * * @example * var reflector = new ($najax.Reflector()); * * reflector.render('#target', url); * reflector.render('#target', url, {v: v}); * reflector.render('#target', url, null, function(v){ ... return v; }); * * var Reflector = $najax.Reflector(); * var nx = $najax.get(null).timeout(5); * var reflector = new Reflector(nx); * * reflector.type('html').render('#target', url); * reflector.typeJson(function(v){ ... return v;}).render('#target', url); * reflector.type('json').render('#target', url, null, function(v){ return this.list(v.list, function(k, v){ ... return v;}); }); */ var Reflector = function(nx){ this._nx = nx || null; this._el = null; this._type = null; this._filter = null; }; ext(Reflector.prototype, { /** * Set and get Nx object. * * @function * @name nx * @memberof Reflector * @instance * * @param {Nx} [nx] Nx object. * @returns {void|Nx} * * @tutorial najax-class * * @example * var nx = $najax.get(null).retry(1); * reflector.nx(nx); //Set * * vsr nx = reflector.nx(); //Get */ nx: function(nx){ if (nx === undefined){ return this._nx; } this._nx = nx; return this; }, /** * Set type and filter function. * * @function * @name type * @memberof Reflector * @instance * * @param {string} type Type. &lt;code&gt;raw(default), text&lt;/code&gt; / &lt;code&gt;html&lt;/code&gt; / &lt;code&gt;json&lt;/code&gt; / &lt;code&gt;&lt;i&gt;any other Nx.type&lt;/i&gt;&lt;/code&gt; * @param {function} [filter] Filter function. &lt;code&gt;function(v:*){ return {string}; }&lt;/code&gt; * * @tutorial najax-class * * @example * reflector.type('html'); * reflector.type('json'); * reflector.type('raw'); * reflector.type(null, function(v){ ... return v;}); * reflector.type('json', function(v){ ... return v;}); */ type: function(type, filter){ this._type = type; this.filter(filter); return this; }, /** * Set &lt;i&gt;Json&lt;/i&gt; type. Wrapper of &lt;i&gt;type&lt;/i&gt; method. * * @function * @name typeJson * @memberof Reflector * @instance * * @param {function} [filter] Filter function. &lt;code&gt;function(v:*){ return {string}; }&lt;/code&gt; * * @tutorial najax-class * * @example * reflector.typeJson(); * reflector.typeJson(function(v){ ... return v;}); */ typeJson: function(filter){ this.type('json', filter); return this; }, /** * Set &lt;i&gt;HTML&lt;/i&gt; type. Wrapper of &lt;i&gt;type&lt;/i&gt; method. * * @function * @name typeHtml * @memberof Reflector * @instance * * @param {function} [filter] Filter function. &lt;code&gt;function(v:*){ return {string}; }&lt;/code&gt; * * @tutorial najax-class * * @example * reflector.typeHtml(); * reflector.typeHtml(function(v){ ... return v;}); */ typeHtml: function(filter){ this.type('json', filter); return this; }, /** * Set filter function. * * @function * @name filter * @memberof Reflector * @instance * * @param {function} [fn] Filter function. &lt;code&gt;function(v:*){ return {string}; }&lt;/code&gt; * * @tutorial najax-class * * @example * reflector.filter(function(v){ ... return v;}); */ filter: function(fn){ this._filter = fn || null; return this; }, /** * Create combined string by assoc and function. * * @function * @name list * @memberof Reflector * @instance * * @param {array|assoc} vs Array or Assoc values. * @param {function} fn Filter function for single item. &lt;code&gt;function(v:*){ return {string}; }&lt;/code&gt; * @returns {string} Combined string. * * @tutorial najax-class * * @example * reflector.filter(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); * reflector.jsonType(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); */ list: function(vs, fn){ var r = ''; for (var k in vs){ if (vs.hasOwnProperty(k)){ r += fn(k, vs[k]); } } return r; }, /** * Ajax &amp; render to content. * * @function * @name render * @memberof Reflector * @instance * * @param {string|Element} el Element or Element selector. * @param {string} url URL. * @param {assoc} [vs] URL parameter values. * @param {function} [filter] Filter function. See &lt;i&gt;Reflector.filter&lt;/i&gt; for detail. * @returns {Relay} &lt;i&gt;Relay&lt;/i&gt; object by &lt;i&gt;Nx.done&lt;/i&gt;. * * @tutorial najax-class * * @example * reflector.filter(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); * reflector.jsonType(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); */ render: function(el, url, vs, filter){ this._el = el; if (!this._nx){ this._nx = $najax.get(null); } this._nx.type((this._type == 'html')?'raw':this._type); return this._nx.url(url).param(vs).__set('__after', this.__apply(filter)).clean(false).done(); }, /** * @ignore */ __apply: function(fn){ return bind(this, function(v){ var el = (typeof this._el === 'string')?document.querySelector(this._el):this._el; v = this.__filter(fn, v); if (typeof v === 'object'){ console.error(&quot;Can't render object.&quot;); return; } switch (this._type){ case 'html': njx.parseHTML(el, v); break; case 'json': case 'raw': default: el.innerHTML = v; break; } }); }, /** * @ignore */ __filter: function(fn, v){ if (!fn &amp;&amp; !this._filter){ return v; } return (fn || this._filter).call(this, v); } }); /** * Reflector-class builder. * * @function Reflector * @memberof $najax@class * @returns {Reflector} Reflector class. * * @see Reflector * * @tutorial najax-class * @tutorial demo-ui-ajax * * @example * var reflector = new ($najax.Reflector()); * * reflector.render('#target', url); * reflector.render('#target', url, {v: v}); * reflector.render('#target', url, null, function(v){ ... return v; }); * * var Reflector = $najax.Reflector(); * var nx = $najax.get(null).timeout(5); * var reflector = new Reflector(nx); * * reflector.type('html').render('#target', url); * reflector.typeJson(function(v){ ... return v;}).render('#target', url); * reflector.type('json').render('#target', url, null, function(v){ return this.list(v.list, function(k, v){ ... return v;}); }); */ njx.Reflector = function(){ return Reflector; }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"najax-helper.static.js.html":{"id":"najax-helper.static.js.html","title":"Source: najax-helper.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: najax-helper.static.js 'use strict'; /** * $najax helper methods. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | Yes | * * @namespace $najax@helper * @tutorial najax-helper * * @example * v = $najax.escape(1); * v = $najax.escape('E=M+C+2'); * * url = $najax.url('ajax.php', {a:1, b:2, c:3}); * url = $najax.url('ajax.php', {a:1, b:2}, true); * * qs = $najax.query(true); * * $najax.parseHTML(el, html); * * $najax.submit('form.php', vs); * $najax.submit('form.php', vs, {method: 'POST', target: '_blank'}); * $najax.iframeHtml(el, '&lt;div&gt;content&lt;/div&gt;'); */ /** * @ignore */ function qsVs(q, dc){ var r = {}, ps = q.split('&amp;'), p, v; for (var i = 0; i &lt; ps.length; i++){ if (ps[i] != '') { p = ps[i].split('='); v = (p[1] === undefined)?null:p[1]; if (dc){ try { v = decodeURI(v); } catch(e) { v = null; } } r[p[0]] = v; } } return r; } /** * Escape value. * @function escape * @memberof $najax@helper * * @param {string} v Parameter value. * @returns {string} * * @see $najax.params * @see $najax.url * * @tutorial najax-helper * * @example * v = $najax.escape(1); * v = $najax.escape('E=M+C+2'); * v = $najax.escape('K V S'); */ njx.escape = function(v){ return encodeURIComponent(v).replace(/%20/g, '+'); }; /** * @ignore */ function prms(vs, pre, f){ var s = '', nm; for (var k in vs){ if (vs.hasOwnProperty(k)){ nm = f(k); if (pre){ nm = pre + '[' + nm + ']'; } if (!(vs[k] instanceof Object)){ s+= nm + '=' + f(vs[k]) + '&amp;'; }else{ s+= prms(vs[k], nm, f); } } } return s; } /** * @ignore */ function rawv(v){ return v; } /** * Return string values. * @function params * @memberof $najax@helper * * @param {assoc} vs Parameter values. * @param {boolean} [noescape=false] If true, not escape values. * @returns {string} * * @see $najax.escape * @see $najax.url * * @tutorial najax-helper * * @example * v = $najax.params({a: 1}); * v = $najax.params({a: 1, b:2}, true); * v = $najax.params({K:'V S', E:'M C'}); */ njx.params = function(vs, noescape){ var s; if (!noescape){ s = prms(vs, '', njx.escape); }else{ s = prms(vs, '', rawv); } return s.slice(0, -1); }; /** * Create url by params. URL's query-string value is overridden by parameter-values. * @function url * @memberof $najax@helper * * @param {string} url URL. * @param {assoc} vs Parameter values. * @param {boolean} [noescape=false] If true, not escape values. * @returns {string} * * @see $najax.escape * @see $najax.params * * @tutorial najax-helper * * @example * url = $najax.url('ajax.php', {a:1, b:2, c:3}); * url = $najax.url('ajax.php', {a:1, b:2}, true); * url = $najax.url('ajax.php?a=0&amp;d=3', {a:1, b:2, c:3}); * url = $najax.url('ajax.php?a=x+y&amp;', {a:'NX', b: 'E=M+C+2', d:'K V S'}); */ njx.url = function(url, vs, noescape){ if (!vs){ return url; } var t = /^([^\\?#]*)\\??([^#]*)#?(.*)$/.exec(url), q = qsVs(t[2], false), k; for (k in vs){ if (vs.hasOwnProperty(k)){ q[k] = vs[k]; } } url = t[1]; if (!isEmp(q)){ url+= '?' + njx.params(q, noescape); } if (t[3]){ url+= '#' + t[3]; } return url; }; /** * Parse query string and return parameter assoc. * @function query * @memberof $najax@helper * * @param {boolean} [hash=false] If true, include URL's hash fragment(#). * @returns {assoc} * * @tutorial najax-helper * * @example * qs = $najax.query(); * */ njx.query = function(hash){ var q, rv = /\\?(.+)$/.exec(location.search); if (rv){ q = qsVs(rv[1], true); }else{ q = {}; } return q; }; /** * Get hash. * @function hash * @memberof $najax@helper * * @returns {string} * * @tutorial najax-helper * * @example * hash = $najax.hash(); * */ njx.hash = function() { return location.hash.replace('#', ''); }; /** * @ignore */ function sbmSet(c, nm, vs){ for (var k in vs){ if (vs.hasOwnProperty(k)){ var v = vs[k]; if (nm != null){ k = nm + '[' + k + ']'; } if (v instanceof Object){ sbmSet(c, k, v); }else{ var t = document.createElement('input'); attr(t, 'type', 'hidden'); attr(t, 'name', k); attr(t, 'value', v); c.appendChild(t); } } } } /** * @ignore */ function cpy(nc, tc, nm){ if (tc[nm] != null &amp;&amp; tc[nm] != ''){ nc[nm] = tc[nm]; } } /** * @ignore */ function htmPrs(c){ var tc; for (var i=0;i&lt;c.children.length;i++){ tc = c.children[i]; if (tc.children.length &gt; 0){ htmPrs(tc); }else{ if (tc.tagName.toLocaleLowerCase() === 'script'){ var nc = document.createElement('script'); cpy(nc, tc, 'type'); cpy(nc, tc, 'language'); cpy(nc, tc, 'charset'); cpy(nc, tc, 'async'); cpy(nc, tc, 'defer'); cpy(nc, tc, 'src'); nc.text = tc.text; c.replaceChild(nc, tc); } } } } /** * Parse HTML with evaluating JavaScript. * @function parseHTML * @memberof $najax@helper * * @param {Element} el Destination element. * @param {string} src HTML source. * * @tutorial najax-helper * * @example * $najax.parseHTML(el, html); */ njx.parseHTML = function(el, src){ el.innerHTML = src; htmPrs(el); }; /** * Submit values by form Element. * @function submit * @memberof $najax@helper * * @param {string} url URL. * @param {assoc} [vs=null] Parameter. * @param {assoc} [opt] Option. * @param {Element} [opt.form] Form Element. * @param {string} [opt.method=null] Method(GET | POST). * @param {string} [opt.target] Target window. * @param {string} [opt.enctype] Form enctype. * @return {Element} * * @tutorial najax-helper * @example * $najax.submit('form.php', vs); * $najax.submit('form.php', vs, {method: 'POST', target: '_blank'}); * $najax.submit('form.php', vs, {form: '#form', target: '_blank'}); */ njx.submit = function(url, vs, opt){ opt = ext({form: null, method: null, target: null, enctype: null}, opt); var c, fm = false; if (opt.form){ c = opt.form; }else{ fm = true; c = document.createElement('form'); c.style.display = 'none'; document.body.appendChild(c); } if (fm || opt.method){ attr(c, 'method', opt.method); } if (fm || url){ attr(c, 'action', url); } if (fm || opt.enctype){ attr(c, 'enctype', opt.enctype); } if (fm || opt.target){ attr(c, 'target', opt.target); } sbmSet(c, null, vs); c.submit(); return c; }; /** * Create iframe content by source. * @function iframeHtml * @memberof $najax@helper * * @param {Element} el Iframe Element. * @param {string} src HTML source. * @param {assoc} [opt] Option. * @param {boolean} [opt.all=false] If true, all content mode. or false, body content mode. * @param {string} [opt.charset='utf-8'] Charset. * @param {string} [opt.css=''] CSS Style. * @param {string} [opt.js=''] JavaScript source. * * @tutorial najax-helper * * @example * $najax.iframeHtml(el, '&lt;div&gt;content&lt;/div&gt;'); * $najax.iframeHtml(el, '&lt;html&gt;....&lt;/html&gt;', {all: true}); * $najax.iframeHtml(el, src, {css: 'body: {font-size:12pt;}'}); * $najax.iframeHtml(el, src, {js: 'alert(&quot;demo&quot;);'}); */ njx.iframeHtml = function(el, src, opt) { opt = ext({all: false, charset: 'utf-8', css: '', js: ''}, opt); var s, d = el.contentWindow || el.contentDocument; if (!opt.all){ s = '&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset=' + opt.charset + '&gt;&lt;/head&gt;'; if (opt.css){ s += '&lt;style type=&quot;text/css&quot;&gt;' + opt.css + '&lt;/style&gt;'; } if (opt.js){ s += '&lt;script type=&quot;text/javascript&quot;&gt;' + opt.js + '&lt;/script&gt;'; } s += '&lt;/head&gt;&lt;body&gt;' + src + '&lt;/body&gt;&lt;/html&gt;'; }else{ s = src; } if (d){ d.document.open(); d.document.write(s); d.document.close(); } }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"najax-read.static.js.html":{"id":"najax-read.static.js.html","title":"Source: najax-read.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: najax-read.static.js 'use strict'; /** * $najax read methods. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | Yes | * * @namespace $najax@read * @tutorial najax-read * * @example * $najax.require('sample.js'); * $najax.require(['s1.js', 's2.js'], {base: 'path/'}).done(function(s1, s2){ ... }); * * $najax.ready(function(){ ... }); * * $najax.load('#target', 'demo.php', {a: 1, b: 2}); * * $najax.module('template.php'); */ var rqFn = null; function rqSc(){ this.data({fn: rqFn}); rqFn = null; } /** * Load script and pass &lt;i&gt;function object&lt;/i&gt; by &lt;code&gt;$najax.ready&lt;/code&gt; to arguments. * * @function require * @memberof $najax@read * * @param {string|array} path Path or Paths. * @param {assoc} [opt] Nx options. * @param {string} [opt.base=''] Base path. * @param {boolean} [opt.run=false] Run script after loading. * @param {number} [opt.relaymode=2] For details, see $najax.define.relaymode. * @param {boolean} [opt.cache=true] Enable cache. * @returns {Linker} * * @see $najax.ready * @see $najax.define.relaymode * * @see Nx * @see Relay * @see Linker * * @tutorial najax-read * @example * $najax.require('sample.js'); * $najax.require(['s1.js', 's2.js'], {base: 'path/'}).done(function(s1, s2){ ... }); * $najax.require(['AClass.js', 'BClass.js']).done(function(AClass, BClass){ ... }); * $najax.require('sample.js', {run: true}); */ njx.require = function(path, opt){ opt = ext({base: '', run: false, relaymode: 2, cache: true}, opt); if (typeof path === 'string'){ path = [path]; } var rls = []; for (var i=0;i&lt;path.length;i++){ rls[i] = njx.script(opt.base + path[i], null, opt).complete(rqSc).done(); } return njx.linker.apply(null, rls).argument(function(rl){ var f = rl.data('fn'); if (opt.run &amp;&amp; f){ f = f(); } return f; }).lock(); }; /** * Ready function for $najax.require. * * @function ready * @memberof $najax@read * * @param {function} fn Function. * * @see $najax.require * * @tutorial najax-read * @example * $najax.ready(function(){ ... }); * $najax.ready($any.makeClass( ... )); */ njx.ready = function(fn){ if (fn){ rqFn = fn; } }; /** * Load template and append HTML and JS to Element. If target Element is null, append to document bottom(auto-append). * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * Naming in auto-append: &lt;code&gt;prefix + CRC code created by url. Ex: id=njx5690&lt;/code&gt; * &lt;code&gt;_elem&lt;/code&gt; by Relay::data is Element. * * @function load * @memberof $najax@read * * @param {Element} el Element. If null, append automatically as a last Element - auto-append. * @param {string} url URL * @param {assoc} [vs=null] Parameter * @param {assoc} [opt] Nx options. * @param {string} [opt.prefix='njx'] When appending to as last Element, it's possible to specify Element's id prefix. * @param {number} [opt.relaymode=3] For details, see $najax.define.relaymode. * @returns {Linker} * * @see $najax.module * @see $najax.define.relaymode * @see Nx * @see Relay * @see Linker * * @tutorial najax-read * @example * $najax.load('#target', 'demo.php', {a: 1, b: 2}); * $najax.load(null, 'demo.php').done(function(data){ ... }); */ njx.load = function(el, url, vs, opt){ opt = ext({prefix: 'njx', relaymode: 3}, opt); opt.cache = true; if (!el){ el = document.createElement('div'); el.id = opt.prefix + $any.crc16(url); el.style.display = 'none'; document.body.appendChild(el); } opt.element = el; var rl = njx.html(url, vs, opt).done(); if (opt.relaymode &amp; 2){ rl.data('_elem', el); } return njx.linker(rl); }; /** * Load module - Wrapper of $najax.load. Append to document bottom. * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * Append module(HTML and script) to document bottom. * * @function module * @memberof $najax@read * * @param {string} url URL * @param {assoc} [opt] $najax.load options. * @returns {Linker} * * @see $najax.load * @see Nx * @see Relay * @see Linker * * @tutorial najax-read * @example * $najax.module('template.php'); */ njx.module = function(url, opt){ return njx.load(null, url, null, opt); }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"relaylinker.static.js.html":{"id":"relaylinker.static.js.html","title":"Source: relaylinker.static.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: relaylinker.static.js 'use strict'; /** * Relay / &lt;i&gt;Linker&lt;/i&gt; class. It's possible to operate response-data and behaviors after completed. * Provide 'Data-relay' and 'Abort', 'Bundle multiple &lt;i&gt;Relay&lt;/i&gt; object by &lt;i&gt;Linker&lt;/i&gt;'. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | Yes | * * @namespace $najax@rlk * * @tutorial relaylinker * @tutorial rlk-standalone * * @see Relay * @see Linker * * @example * var rl1 = $najax.request.done(); //Relay object. * var rl2 = $najax.post.done(); //Relay object. * $rlk.linker(rl1, r2).done(function(){ ... }); * * var rl1 = new ($najax.RelayClass()); * $najax.linker(rl, r2).success(function{ ... }).done(); * * var rl1 = new ($rlk.RelayClass()); * $rlk.linker(rl, r2).success(function{ ... }).done(); * * var rl12 = $rlk.linker(rl1, r2).done(); * $rlk.linker(rl3, rl12).done(function(){ ... }); */ /** * &lt;i&gt;Relay&lt;/i&gt; class. Provide 'Data-relay' and 'Abort', 'Bundle multiple &lt;i&gt;Relay&lt;/i&gt; object by &lt;i&gt;Linker&lt;/i&gt;'. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | Yes | * * @class Relay * * @see Linker * * @tutorial relaylinker * @tutorial rlk-standalone * * @example * Relay = $najax.relayClass(); * Relay = $rlk.relayClass(); //standalone */ var Relay = function(){ this._state = 0; this._active = 0; this._args = []; this._data = null; this._linker = null; this._abort = null; }; /** * Initialize values and state. * @function * @name init * @memberof Relay * @instance * * @returns {Relay} * * @example * rl.init(); */ Relay.prototype.init = function(){ this._state = 0; this._active = 0; this._args = []; this._data = null; return this; }; /** * Set state and passed args. * * &lt;b&gt;State value type&lt;/b&gt; * * | Value | Description | * |:---|:---| * | &lt;code&gt;1&lt;/code&gt; | Success | * | &lt;code&gt;-1&lt;/code&gt; | Fail | * | &lt;code&gt;-2&lt;/code&gt; | Abort | * * @function * @name setState * @memberof Relay * @instance * * @param {number} [state=null] State. * @param {assoc} [vs=null] Argument values. * @returns {Relay} * * @example * rl.setState(1); //Success * rl.setState(-1); //Fail * rl.setState(-2); //Abort * rl.setState(null, ags); //Set args. */ Relay.prototype.setState = function(state, vs){ if (state != null &amp;&amp; this._state != -2){ this._state = state; } if (vs &amp;&amp; vs.length &gt; 0){ this._args = vs; } return this; }; /** * Notify success with args. * * @function * @name notifySuccess * @memberof Relay * @instance * * @param {...*} [v] Passed argument values. * @returns {Relay} * * @see Relay#notifyFail * * @example * rl.notifySuccess(); * rl.notifySuccess(true, e); */ Relay.prototype.notifySuccess = function(){ this.setState(1, args(arguments)); rlTrg(this); return this; }; /** * Notify fail with args. * * @function * @name notifyFail * @memberof Relay * @instance * * @param {...*} [v] Passed argument values. * @returns {Relay} * * @see Relay#notifySuccess * * @example * rl.notifyFail(); * rl.notifyFail(false, e); */ Relay.prototype.notifyFail = function(){ this.setState(-1, args(arguments)); rlTrg(this); return this; }; /** * Set abort function. It runs when calling &lt;i&gt;abort&lt;/i&gt;. * * @function * @name abortCaller * @memberof Relay * @instance * * @param {function} [fn] Function. * @returns {Relay} * * @see Relay#abort * * @example * rl.abortCaller(fn); */ Relay.prototype.abortCaller = function(fn){ this._abort = fn; }; /** * Get argument value or values. * * @function * @name get * @memberof Relay * @instance * * @param {number} [i=null] Index. If null, all values. * @returns {*} Value. * * @example * v = rl.get(0); * v = rl.get(1); * vs = rl.get(); */ Relay.prototype.get = function(i){ if (i === undefined){ return this._args; } return this._args[i]; }; /** * Get value of first argument. * * @function * @name value * @memberof Relay * @instance * * @returns {*} Value. * * @example * v = rl.get(0); * vs = rl.get(); */ Relay.prototype.value = function(){ return this._args[0]; }; /** * Get and set original data. See example for detail. * * @function * @name data * @memberof Relay * @instance * * @param {string|assoc|null} [w] Name or assoc. * @param {*} [v] Value. * @returns {*|assoc|void} * * @example * //Get * all = rl.data(); //All values. * v = rl.data('a'); //Specify name. * * //Set * rl.data('a', 1); //By simple value. * rl.data({'a': 1}); //By assoc. */ Relay.prototype.data = function(w, v){ if (w === undefined){ return this._data; }else if (typeof w !== 'object' &amp;&amp; v === undefined){ return this._data[w]; } if (this._data === null){ this._data = {}; } extVs(this._data, w, v); }; /** * Get state. * * @function * @name state * @memberof Relay * @instance * * @returns {number} State. * * @example * v = rl.state(); */ Relay.prototype.state = function(){ return this._state; }; /** * Is active. * * @function * @name isActive * @memberof Relay * @instance * * @returns {boolean} Is active. * * @example * v = rl.isActive(); */ Relay.prototype.isActive = function(){ return this._active; }; /** * Call abort. * @function * @name abort * @memberof Relay * @instance * * @returns {Relay} * * @see Relay#abortCaller * * @example * rl.abort(fn); */ Relay.prototype.abort = function(){ this._state = -2; if (this._abort){ this._abort(this); } this.notifyFail(); return this; }; /** * Clear all values and related Relay object. * @function * @name clear * @memberof Relay * @instance * * @example * rl.clear(); */ Relay.prototype.clear = function(){ var v; for (var i=0;i&lt;this._args.length;i++){ v = this._args[i]; if (v instanceof Relay &amp;&amp; v.clear){ v.clear(); } } clear(this); }; /** * Get related linker. * @function * @name linker * @memberof Relay * @instance * * @returns {Linker} Related &lt;i&gt;Linker&lt;/i&gt; object. * * @example * linker = rl.linker(); */ Relay.prototype.linker = function(){ return this._linker; }; function rlRsp(rls, type){ var r = [], i; if (typeof type !== 'function'){ switch(type){ case 'first': r = rls[0].get(); break; case 'value': for(i = 0; i &lt; rls.length; i++){ r.push(rls[i].get(0)); } break; case 'data': for(i = 0; i &lt; rls.length; i++){ r.push(rls[i].data()); } break; case 'relay': default: return rls; break; } }else{ for (i=0;i&lt;rls.length;i++){ r.push(type(rls[i])); } } return r; } function rlPrp(lk){ var rl, i; if (lk._rls[lk._rls.length - 1] === true){ lk._rls.pop(); lk.init(); } for (i=0;i&lt;lk._rls.length;i++){ rl = lk._rls[i]; if (rl._active != 0){ console.error('cancel linker, used object.', rl); return; } } for (i=0;i&lt;lk._rls.length;i++){ rl = lk._rls[i]; rl._active = 1; rl._linker = lk; } } function rlTrg(rl){ var lk = rl.linker(); if (rl._active == 1){ rl._active = 2; }else{ return; } var r = true, i; for (i=0;i&lt;lk._rls.length;i++){ switch(lk._rls[i]._state){ case 0: return; break; case -1: case -2: r = false; break; default: break; } } var vs = rlRsp(lk._rls, lk._argument); if (r){ if (lk._sccs){ lk._sccs.apply(lk, vs); } if (lk._relay &amp;&amp; lk._relay._linker){ lk._relay.notifySuccess.apply(lk._relay, lk._rls); } }else{ if (lk._fail){ lk._fail.apply(lk, vs); } if (lk._relay &amp;&amp; lk._relay._linker){ lk._relay.notifyFail.apply(lk._relay, lk._rls); } } if (lk._cmpl){ lk._cmpl.apply(lk, vs); } if (lk._rls){ for (i = 0; i &lt; lk._rls.length; i++){ lk._rls[i]._linker = null; lk._rls[i]._abort = null; } } } /** * &lt;i&gt;Linker&lt;/i&gt; class. Provide 'data relay' and 'abort', 'bundle multiple relay object by &lt;i&gt;Linker&lt;/i&gt;'. &lt;i&gt;Linker&lt;/i&gt; bundle &lt;i&gt;Relay&lt;/i&gt;. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | Yes | * * @class Linker * * @see Relay * * @tutorial relaylinker * @tutorial rlk-standalone * * @example * Linker = $najax.linkerClass(); * Linker = $rlk.linkerClass(); //standalone */ var Linker = function(rls){ this._rls = args(rls); this._argument = 'relay'; this._sccs = null; this._fail = null; this._cmpl = null; this._lock = false; this._relay = null; rlPrp(this); }; /** * Initialize all &lt;i&gt;Relay&lt;/i&gt; objects. * @function * @name init * @memberof Linker * @instance * * @returns {Linker} * * @example * linker.init(); */ Linker.prototype.init = function(){ if (this._lock){ console.error('not available'); return; } for (var i=0;i&lt;this._rls.length;i++){ this._rls[i].init(); } return this; }; /** * Set argument type. * * &lt;b&gt;Argument types&lt;/b&gt;&lt;br&gt; * &lt;code&gt;first&lt;/code&gt; First relay's arguments.&lt;br&gt; * &lt;code&gt;value&lt;/code&gt; Value of first argument.&lt;br&gt; * &lt;code&gt;data&lt;/code&gt; Original data.&lt;br&gt; * &lt;code&gt;relay(default)&lt;/code&gt; Relay object.&lt;br&gt; * * @function * @name argument * @memberof Linker * @instance * * @param {string} type Argument type. * @returns {Linker} * * @example * linker.argument('value').done(function(v1, v2){ ... }); * linker.argument('first').done(function(v, x, y){ ... }); * linker.argument('data').done(function(data1, dat2){ ... }); * linker.argument('relay').done(function(rl1, rl2){ ... }); //default * * $najax.linker(rl).argument('value').done(function(v1){ ... }); * rlk.linker(rl).argument('value').done(function(v1){ ... }); */ Linker.prototype.argument = function(type){ if (this._lock){ console.error('not available'); return; } this._argument = type; return this; }; /** * Set success function. * * @function * @name success * @memberof Linker * @instance * * @param {function} fn Success function. * @returns {Linker} * * @see Linker#fail * @see Linker#complete * @see Linker#done * * @example * linker.success(fn); */ Linker.prototype.success = function(fn){ this._sccs = fn; return this; }; /** * Set fail function. * * @function * @name fail * @memberof Linker * @instance * * @param {function} fn Fail function. * @returns {Linker} * * @see Linker#success * @see Linker#complete * @see Linker#done * * @example * linker.fail(fn); */ Linker.prototype.fail = function(fn){ this._fail = fn; return this; }; /** * Set complete function. * * @function * @name complete * @memberof Linker * @instance * * @param {function} fn Complete function. * @returns {Linker} * * @see Linker#success * @see Linker#fail * @see Linker#done * * @example * linker.complete(fn); */ Linker.prototype.complete = function(fn){ this._cmpl = fn; return this; }; /** * Set function and return &lt;i&gt;Relay&lt;/i&gt; object. * * @function * @name done * @memberof Linker * @instance * * @param {function} [success] Success function. * @param {function} [fail] Fail function. * @param {function} [complete] Complete function. * @returns {Relay} Relay object. * * @see Linker#success * @see Linker#fail * @see Linker#complete * * @example * linker.done(); * linker.done(success); * linker.done(success, fail ,complete); */ Linker.prototype.done = function(success, fail, complete){ if (success){ this._sccs = success; } if (fail){ this._fail = fail; } if (complete){ this._cmpl = complete; } this._relay = new Relay(); return this._relay; }; /** * Clear all &lt;i&gt;Relay&lt;/i&gt; objects and clear values. * * @function * @name clear * @memberof Linker * @instance * * @example * linker.clear(); */ Linker.prototype.clear = function(){ for (var i=0;i&lt;this._rls.length;i++){ if (this._rls[i].clear){ this._rls[i].clear(); } } clear(this); }; /** * Abort all &lt;i&gt;Relay&lt;/i&gt; objects. * * @function * @name abort * @memberof Linker * @instance * * @returns {Linker} * * @example * linker.abort(); */ Linker.prototype.abort = function(){ for (var i=0;i&lt;this._rls.length;i++){ this._rls[i].abort(); } return this; }; /** * Lock. * * @function * @name lock * @memberof Linker * @instance * @returns {Linker} * * @example * linker.lock(); */ Linker.prototype.lock = function(){ this._lock = true; return this; }; /** * Bundle &lt;i&gt;Relay&lt;/i&gt; object. And providing result methods. * * @function * @name linker * @function linker * @memberof $najax@rlk * * @param {...Relay} [rl] Relay object. * * @returns {Linker} &lt;i&gt;Linker&lt;/i&gt; object. * * @see Relay * @see Linker * * @tutorial relaylinker * @tutorial rlk-standalone * * @example * $najax.linker(rl).success(function(){ ... }); * $najax.linker(rl).success(function{ ... }).fail(function{ ... }).done(function(){ ... }); * $najax.linker(rl).done(function(){ ... }); * $najax.linker(rl1, rl2, rl3).done(function(r1, r2, r3){ ... }); * $najax.linker(rl1, rl2, rl3).argument('value').done(function(v1, v2, v3){ ... }); * $najax.linker(rl1).argument('first').done(function(v, obj, type){ ... }); * var linker = $najax.linker(rl).done();linker.clear(); * * $rlk.linker(rl1, rl2, rl3); //standalone */ njx.linker = function(){ return new Linker(arguments); }; /** * Return &lt;i&gt;Relay&lt;/i&gt; class. * * @function RelayClass * @memberof $najax@rlk * * @returns {Linker} &lt;i&gt;Linker&lt;/i&gt; class. * * @see Relay * @see Linker * * @tutorial relaylinker * @tutorial rlk-standalone * * @example * Relay = $najax.relayClass(); * Relay = $rlk.relayClass(); //standalone */ njx.RelayClass = function(){ return Relay; }; /** * Return &lt;i&gt;Linker&lt;/i&gt; class. * * @function LinkerClass * @memberof $najax@rlk * * @returns {Linker} &lt;i&gt;Linker&lt;/i&gt; class. * * @see Relay * @see Linker * * @tutorial relaylinker * @tutorial rlk-standalone * * @example * Linker = $najax.linkerClass(); * Linker = $rlk.linkerClass(); //standalone */ njx.LinkerClass = function(){ return Linker; }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"common.define.js.html":{"id":"common.define.js.html","title":"Source: common.define.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: common.define.js 'use strict'; /** * Assoc object. * @typedef {object&lt;string, *&gt;} assoc * @example { a: 1, b: '2', c: {c1: 1, c2: 2} } */ /** * Functions object. * @typedef {object&lt;string, function&gt;} functions * @example { a: function(v){ }, b: function(v){ } } */ /** * Class expression. * @typedef {Object} Class * @example - Class object */ × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"najax-core.js.html":{"id":"najax-core.js.html","title":"Source: najax-core.js","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Source: najax-core.js 'use strict'; /* global nxXHR: false */ /** * @ignore */ var Bx = { __basic: function(url, vs, type){ this._url = url; if (vs){ this._vs = vs; } if (type){ this._o.type = type; } return this; }, type: function(type){ this._o.type = type || ''; return this; }, url: function(url){ this._url = url; return this; }, param: function(w, v){ if (!this._vs){ this._vs = {}; } extVs(this._vs, w, v); return this; }, cache: function(on){ this._o.cache = on; return this; }, retry: function(n){ this._o.retry = n; return this; }, success: function(fn){ this._sccs = fn; return this; }, fail: function(fn){ this._fail = fn; return this; }, begin: function(fn){ if (!this.__exist('begin', '_begin')){ this._begin = fn; } return this; }, running: function(fn){ if (!this.__exist('running', '_running')){ this._running = fn; } return this; }, complete: function(fn){ if (!this.__exist('complete', '_cmpl')){ this._cmpl = fn; } return this; }, jsonp: function(callback, name){ this._o.type = 'jsonp'; if (callback){ if (typeof callback === 'function'){ callback = callback.name; } this._o.jsonp.callback = callback; } if (name){ this._o.jsonp.name = name; } return this; }, clean: function(on){ this._o.clean = on; return this; }, relay: function(w, v){ if (!this._relaydata){ this._relaydata = {}; } this._o.relaymode = this._o.relaymode | 2; extVs(this._relaydata, w, v); return this; }, opt: function(w, v){ extVs(this._o, w, v); return this; }, __set: function(n, v){ this[n] = v; return this; }, __done: function(sc, fl, cmp){ if (sc){ this._sccs = sc; } if (fl){ this._fail = fl; } if (cmp){ this._cmpl = cmp; } }, __exist: function(n, f){ if (this[f] != null){ error('already exist. (' + n + ')'); return true; } return false; }, __start: function(rl, vs){ if (this.__before){ this.__before.apply(rl, vs); } if (this._begin){ this._begin.apply(rl, vs); } if (this._running){ this._running.call(rl, true); } }, __end: function(rl, vs, r){ var t; if (this._cmpl){ t = this._cmpl.apply(rl, vs); } if (this.__after){ vs.push((t !== undefined)?t:r); this.__after.apply(rl, vs); } if (this._running){ this._running.call(rl, false); } } }; function argPss(bx, vs){ return (bx._o.relaymode &amp; 1)?vs:[]; } function preRl(bx, rl){ rl.abortCaller(bind(bx, bx.abort)); if (bx._relaydata &amp;&amp; bx._o.relaymode &amp; 2){ rl.data(bx._relaydata); } } /** * Nx class. This class is created automatically by $najax various method. * * | Method | Default ver | Tiny ver | * |:---|:---:|:---:| * | All methods | Yes | Yes | * * &lt;b&gt;Specification&lt;/b&gt;&lt;br&gt; * - Specify ajax request and response behaviors by &lt;code&gt;Nx object&lt;/code&gt;. * - Specify by Nx object's various method or &lt;code&gt;Nx &lt;i&gt;opt&lt;/i&gt;&lt;/code&gt; method. * - Begin ajax connection by &lt;code&gt;Nx &lt;i&gt;done&lt;/i&gt;&lt;/code&gt;. * - &lt;code&gt;Nx &lt;i&gt;done&lt;/i&gt;&lt;/code&gt; returns &lt;code&gt;Relay object&lt;/code&gt;. * - &lt;code&gt;Relay&lt;/code&gt; provide operating response-data, and bundling multiple &lt;code&gt;Relay&lt;/code&gt;. * - &lt;code&gt;Nx&lt;/code&gt; implement ajax by using &lt;i&gt;XMLHttpRequest&lt;/i&gt;. * * @class Nx * * @param {assoc} [opt] Nx options. * @param {string} [opt.method='GET'] Method. GET / POST * @param {string} [opt.type='json'] Response type. * @param {boolean} [opt.async=true] Enable async. * @param {boolean} [opt.cache=false] Enable cache. * @param {number} [opt.retry=null] Retry number. * @param {number} [opt.timeout=null] Timeout ms. * @param {function} [opt.filter=null] Response value filter. * @param {string} [opt.contentType='application/x-www-form-urlencoded'] Method POST option. It's possbile to specify &lt;i&gt;content-type&lt;/i&gt;. * @param {string} [opt.mime=null] Mime by XHR. * @param {assoc} [opt.headers={}] HTTP Headers. * @param {string} [opt.token='X-CSRF-Token'] HTTP Header of CSRF token. * @param {boolean} [opt.noescape=false] If true, not escape parameters. Apply to GET or POST parameters. * @param {assoc} [opt.jsonp] Jsonp option. * @param {string|function} [opt.jsonp.callback=''] Jsonp callback function. * @param {string} [opt.jsonp.name='callback'] Jsonp callback variable name. * @param {string|Element} [opt.element='div'] Type html option. Root element or element tag name. * @param {boolean} [opt.iseval=true] Type script option. Determine to use &lt;i&gt;eval&lt;/i&gt;. if false, use &lt;i&gt;function&lt;/i&gt;. * @param {string} [opt.separator=','] Type csv option. Separator. * @param {assoc} [opt.auth] Auth option. * @param {string} [opt.auth.user=null] User name. * @param {string} [opt.auth.pw=null] Password. * @param {number} [opt.relaymode=$najax.define.relaymode] Data relaymode. See $najax.define.relaymode for detail. * @param {boolean} [opt.clean=true] Clear object's values after completed. * * @see $najax.request * @tutorial static-najax * * @example * $najax.request(url).done(); * $najax.post(url).param(vs).done(); * $najax.raw(url).done(function(){ ... }); * $najax.script(url).success(function(){ ... }).done(function(){ ... }); * * var rl = $najax.html(url).done(); */ var Nx = function(opt){ this._url = null; this._vs = null; this._relaydata = null; this._o = ext({ method: 'GET', type: 'json', async: true, cache: false, retry: null, timeout: null, filter: null, contentType: 'application/x-www-form-urlencoded', mime: null, headers: {}, token: 'X-CSRF-Token', noescape: false, jsonp: {callback: '', name: 'callback'}, element: 'div', iseval: true, separator: ',', auth: {user: null, pw: null}, relaymode: njx.define.relaymode, clean: true }, opt); this._upload = null; this._download = null; this._token = null; this._begin = null; this._running = null; this._sccs = null; this._fail = null; this._cmpl = null; this.__url = null; this.__retry = 0; this.__before = null; this.__after = null; this.__xhr = null; this.__type = 'text'; this.__rsp = null; }; /** * Set method. GET / POST * * &lt;b&gt;Method&lt;/b&gt;&lt;br&gt; * * | Method | Description | Related method or option | * | &lt;code&gt;GET(*)&lt;/code&gt; | Http GET. | Nx.param&lt;br&gt;opt.noescape | * | &lt;code&gt;POST&lt;/code&gt; | Http POST. | Nx.param&lt;br&gt;opt.noescape&lt;br&gt;opt.contentType | * * @memberof Nx * @instance * * @param {string} method Method. GET / POST * @returns {Nx} * * @default 'GET' * * @tutorial static-najax * * @example * $najax.request(url).method('get').done(); * $najax.request(url).method('post').done(); */ Nx.prototype.method = function(method){ this._o.method = method; return this; }; /** * Set response type. * * &lt;b&gt;Response type&lt;/b&gt;&lt;br&gt; * * | Type | Description | Value type | Related method or option | * |:---|:---|:---|:---| * | &lt;code&gt;json(*)&lt;/code&gt; | Json. | assoc | | * | &lt;code&gt;raw&lt;/code&gt; | Raw data. | string | | * | &lt;code&gt;text&lt;/code&gt; | Text. &lt;i&gt;text&lt;/i&gt; is same as &lt;i&gt;raw&lt;/i&gt;. | string | | * | &lt;code&gt;html&lt;/code&gt; | HTML. | Element | opt.element | * | &lt;code&gt;script&lt;/code&gt; | Execute script. | null | opt.iseval | * | &lt;code&gt;func&lt;/code&gt; | Function. | function | | * | &lt;code&gt;jsonp&lt;/code&gt; | Jsonp. | null | Nx.jsonp | * | &lt;code&gt;csv&lt;/code&gt; | Csv(Tsv). | array | opt.separator | * | &lt;code&gt;xml&lt;/code&gt; | Xml. | XMLDocument | | * | &lt;code&gt;blob&lt;/code&gt; | Blob. | Blob | | * | &lt;code&gt;&lt;i&gt;other&lt;/i&gt;&lt;/code&gt; | XMLHttpRequest.responseType. | Varies. | | * * @function * @name type * @memberof Nx * @instance * * @param {string} type Response type. * @returns {Nx} * * @default 'json' * * @tutorial static-najax * * @example * $najax.request(url).type('raw').done(); * $najax.request(url).type('html').done(); * $najax.request(url).type('script').done(); */ /** * Set url. * @function * @name url * @memberof Nx * @instance * * @param {string} url URL. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(null).url(url).done(); */ /** * Set param. GET: URL parameters, POST: POST parameters. * @function * @name param * @memberof Nx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).param('a', 1).param('b', 1).done(); * $najax.request(url).param({a: 1, b:2, c:3}).done(); */ /** * Set async or sync. * @memberof Nx * @instance * * @param {boolean} on Async flag. * @returns {Nx} * * @default true * * @tutorial static-najax * * @example * $najax.request(url).async(false).done(); //sync */ Nx.prototype.async = function(on){ this._o.async = on; return this; }; /** * Set cache behavior. * @function * @name cache * @memberof Nx * @instance * * @param {boolean} on Determine to cache. * @returns {Nx} * * @default false * * @tutorial static-najax * * @example * $najax.request(url).cache(true).done(); */ /** * Set retry number. * @function * @name retry * @memberof Nx * @instance * * @param {number} n Retry number. * @returns {Nx} * * @default null * * @tutorial static-najax * * @example * $najax.request(url).retry(2).done(); */ /** * Set timeout ms. * @memberof Nx * @instance * * @param {number} s Timeout ms. * @returns {Nx} * * @default null * * @tutorial static-najax * * @example * $najax.request(url).timeout(500).done(); */ Nx.prototype.timeout = function(s){ this._o.timeout = s; return this; }; /** * Set filter function. It's possible to modify response-value. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called after recieving data and before making response-value. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(v:string){ return v; }&lt;/code&gt; * * @memberof Nx * @instance * * @param {function} fn Filter function. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).filter(function(v){ return v; }).done(); */ Nx.prototype.filter = function(fn){ this._o.filter = fn; return this; }; /** * Set jsonp option. * @function * @name jsonp * @memberof Nx * @instance * * @param {string|function} [callback] Jsonp callback function. * @param {string} [name='callback'] Jsonp callback variable name. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).type('jsonp').jsonp('func').done(); * $najax.request(url).type('jsonp').jsonp(func).done(); * $najax.request(url).type('jsonp').jsonp(func, 'callback').done(); */ /** * Set &lt;i&gt;content-type&lt;/i&gt; and mime. Method POST option. * @memberof Nx * @instance * * @param {string} contentType Content-type. * @param {string} mime Mime. * @returns {Nx} * * @default 'application/x-www-form-urlencoded' * * @tutorial static-najax * * @example * $najax.request(url).contentType('application/x-www-form-urlencoded').done(); */ Nx.prototype.contentType = function(contentType, mime){ if (contentType != null){ this._o.contentType = contentType; } if (mime){ this._o.mime = mime; } return this; }; /** * Set HTTP Headers. * @memberof Nx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).header('abc', 'ABC').done(); * $najax.request(url).header({abc: 'ABC'}).done(); */ Nx.prototype.header = function(w, v){ if (!this._o.headers){ this._o.headers = {}; } extVs(this._o.headers, w, v); return this; }; /** * Set CSRF token. * @memberof Nx * @instance * * @param {string} [v] CSRF token value. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).token('Zvds1yfe.f3iF9y4FfsJeMJKlyqYdJ.duJgMi').done(); */ Nx.prototype.token = function(v){ this._token = v; return this; }; /** * Set upload object. Support Form(Element) and input(type=file)(Element), FormData. * @memberof Nx * @instance * * @param {Element|FormData} v Form(Element) / input(type=file)(Element) / FormData. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).upload(input).done(); * $najax.request(url).upload(form).done(); */ Nx.prototype.upload = function(v){ var o; if (v instanceof FormData){ o = v; }else if (v.constructor === Object){ o = new FormData(); for (var k in v){ if (v.hasOwnProperty(k) &amp;&amp; v[k].files){ o.append(k, v[k].files[0]); } } }else if (v instanceof Element){ switch(v.tagName.toLocaleLowerCase()){ case 'form': o = new FormData(v); break; case 'input': o = new FormData(); if (v.files){ o.append(v.name, v.files[0]); } break; default: break; } } this._vs = o; this.method('post'); this.contentType(false); return this; }; /** * Set download and upload progress function. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(e:ProgressEvent, rate:number, xhr:XMLHttpRequest){ ... }&lt;/code&gt; &lt;code&gt;rate: [0.0 - 1.0]&lt;/code&gt; * * @memberof Nx * @instance * * @param {function} [download=null] Download progress function. * @param {function} [upload=null] Upload progress function. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).progress(dl, up).done(); * $najax.request(url).progress(dl).done(); */ Nx.prototype.progress = function(download, upload){ if (download){ this._download = download; } if (upload){ this._upload = upload; } return this; }; /** * Set auth. * @memberof Nx * @instance * * @param {string} user User name. * @param {string} pw Password. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).auth('user', 'password').done(); */ Nx.prototype.auth = function(user, pw){ this._o.auth = {user: user, pw: pw}; return this; }; /** * Set clear behavior. * @function * @name clean * @memberof Nx * @instance * * @param {boolean} on Determine to clear. If true, clear object's values after completed. * @returns {Nx} * * @default true * * @see Nx#clear * @tutorial static-najax * * @example * var nx = $najax.request(url).clean(false);nx.done(); //not clear */ /** * Set relay original data. * @function * @name relay * @memberof Nx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).relay('a', 1).relay('b', 2).done(); * $najax.request(url).relay({a:1, b:2}).done(); */ /** * Set &lt;i&gt;opt&lt;/i&gt; value. * @function * @name opt * @memberof Nx * @instance * * @param {string|assoc} w Name or assoc. * @param {string} [v] Value. * @returns {Nx} * * @tutorial static-najax * * @example * $najax.request(url).opt('noescape', true).done(); * $najax.request(url).opt('relaymode', 1).done(); * $najax.request(url).opt({element: 'div'}).done(); */ /** * Set begin function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called before beginning ajax. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(xhr:XMLHttpRequest){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name begin * @memberof Nx * @instance * * @param {function} fn Begin function. * @returns {Nx} * * @see Nx#success * @see Nx#fail * @see Nx#complete * @see Nx#running * @see Nx#done * * @tutorial static-najax * * @example * $najax.request(url).begin(function(){ ... }).done(); */ /** * Set success function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called when ajax succeed. ex: HTTP code 200. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(v:*, xhr:XMLHttpRequest){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name success * @memberof Nx * @instance * * @param {function} fn Success function. * @returns {Nx} * * @see Nx#begin * @see Nx#fail * @see Nx#complete * @see Nx#running * @see Nx#done * * @tutorial static-najax * * @example * $najax.request(url).success(function(v, xhr){ ... }).done(); */ /** * Set fail function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called when ajax fail. ex: network error, 403, 404, 503 or any other HTTP error. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(state:number, xhr:XMLHttpRequest){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name fail * @memberof Nx * @instance * * @param {function} fn Fail function. * @returns {Nx} * * @see Nx#begin * @see Nx#success * @see Nx#complete * @see Nx#running * @see Nx#done * * @tutorial static-najax * * @example * $najax.request(url).fail(function(state, xhr){ ... }).done(); */ /** * Set complete function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called after ajax completed, both success and fail. * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(v:*, xhr:XMLHttpRequest){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name complete * @memberof Nx * @instance * * @param {function} fn Complete function. * @returns {Nx} * * @see Nx#begin * @see Nx#success * @see Nx#fail * @see Nx#running * @see Nx#done * * @tutorial static-najax * * @example * $najax.request(url).complete(function(v, xhr){ ... }).done(); */ /** * Set running function. * * &lt;b&gt;Function specification&lt;/b&gt;&lt;br&gt; * Called when begin(state=true) and complete(state=false). * * &lt;b&gt;Function structure&lt;/b&gt;&lt;br&gt; * &lt;code&gt;function(state:boolean){ ... }&lt;/code&gt; &lt;code&gt;this: &lt;i&gt;Relay object&lt;/i&gt;&lt;/code&gt; * * @function * @name running * @memberof Nx * @instance * * @param {function} fn Running function. * @returns {Nx} * * @see Nx#begin * @see Nx#success * @see Nx#fail * @see Nx#complete * @see Nx#done * * @tutorial static-najax * * @example * $najax.request(url).running(function(state){ ... }).done(); */ /** * Set success / fail / complete, and begin ajax. * @memberof Nx * @instance * * @param {function} [success] Success function. See &lt;i&gt;Nx.success&lt;/i&gt;. * @param {function} [fail] Fail function. See &lt;i&gt;Nx.fail&lt;/i&gt;. * @param {function} [complete] Complete function. See &lt;i&gt;Nx.complete&lt;/i&gt;. * @returns {Relay} Relay object. * * @see Nx#begin * @see Nx#success * @see Nx#fail * @see Nx#complete * @see Nx#running * * @tutorial static-najax * * @example * $najax.request(url).done(); * $najax.request(url).done(function{ ... }); * $najax.request(url).done(null, function{ ... }); * $najax.request(url).done(null, null, function{ ... }); */ Nx.prototype.done = function(success, fail, complete){ this.__done(success, fail, complete); var rl = new Relay(); this.__xhr = nxXHR(); mkURL(this); preRl(this, rl); nxReady(this, rl); nxSend(this, true, rl); return rl; }; /** * Abort ajax. * @memberof Nx * @instance * * @returns {Nx} * * @tutorial static-najax * * @example * nx.abort(); */ Nx.prototype.abort = function(){ this.__xhr.abort(); return this; }; /** * Clear object's values after completed. * @memberof Nx * @instance * * @tutorial static-najax * * @example * nx.clear(); */ Nx.prototype.clear = function(){ this.__xhr.onreadystatechange = none; this.__xhr.onprogress = none; this.__xhr.upload.onprogress = none; clear(this); }; /** * Get XHR object. * @memberof Nx * @instance * * @returns {XMLHttpRequest} * * @example * var nx = $najax.request(url);nx.done(); * var xhr = nx.xhr(); */ Nx.prototype.xhr = function(){ return this.__xhr; }; ext(Nx.prototype, Bx); function mkURL(bx){ var o = bx._o, u = bx._url; o.type = o.type.toLowerCase(); o.method = (!o.method)?'GET':o.method.toUpperCase(); if (bx._vs &amp;&amp; o.method !== 'POST'){ u = njx.url(u, bx._vs, o.noescape); } if (o.type === 'jsonp'){ u = u + urlAdd(u) + o.jsonp.name + '=' + njx.escape(o.jsonp.callback); } if (!o.cache){ u = utms(u); } bx.__url = u; } function utms(url){ return url + urlAdd(url) + njx.define.utms + '=' + (new Date()).getTime(); } function urlAdd(url){ if (url.search(/\\?/) != -1){ if (url.search(/[\\&amp;\\?]$/) == -1){ return '&amp;'; } }else{ return '?'; } return ''; } function postVs(vs, raw){ if (vs instanceof Object &amp;&amp; vs.constructor === Object || vs instanceof Array){ return njx.params(vs, raw); } return vs; } function nxReady(nx, rl){ switch(nx._o.type){ case 'json': nx.__rsp = rspJson(); break; case 'html': nx.__rsp = rspHtml(nx._o.element); break; case 'script': nx.__rsp = rspScript(nx._o.iseval); break; case 'func': nx.__rsp = rspFunc(); break; case 'jsonp': nx.__rsp = rspScript(nx._o.iseval); break; case 'csv': nx.__rsp = rspCsv(nx._o.separator); break; case 'xml': nx.__type = 'document'; break; case 'blob': nx.__type = 'blob'; break; case 'raw': case 'text': case '': break; default: nx.__type = nx._o.type; break; } if (nx._download){ nx.__xhr.onprogress = function(e){ var r = e.loaded/e.total; nx._download(e, r, nx.__xhr); }; } if (nx._upload){ nx.__xhr.upload.onprogress = function(e){ var r = e.loaded/e.total; nx._upload(e, r, nx.__xhr); }; } nx.__xhr.onreadystatechange = function(){ var xhr = nx.__xhr; if (xhr.readyState == 4){ var v = xhr.response || xhr.responseText, r = null, vs; if (xhr.status == 200){ if (nx._o.relaymode &amp; 4){ rl.data('_raw', v); } if (nx._o.filter){ v = nx._o.filter(v); } if (nx.__rsp){ v = nx.__rsp(v); } vs = [v, xhr]; rl.setState(null, argPss(nx, vs)); if (nx._sccs){ r = nx._sccs.apply(rl, vs); } nx.__end(rl, vs, r); rl.notifySuccess(); }else{ if (nx._o.retry &amp;&amp; nx._o.retry &gt; nx.__retry &amp;&amp; (xhr.status &gt;= 500 || xhr.status == 0)){ nx.__retry++; nxSend(nx, false); return; } if (xhr.status == 0){ error('connection failed.', xhr); } vs = [xhr.status, xhr]; rl.setState(null, argPss(nx, vs)); if (nx._fail){ r = nx._fail.apply(rl, vs); } nx.__end(rl, vs, r); rl.notifyFail(); } if (nx._o.clean){ nx.clear(); nx = rl = null; } } }; } function rspHtml(c){ return function(v){ if (typeof c !== 'object'){ c = document.createElement(c); } njx.parseHTML(c, v); return c; }; } function rspScript(evl){ if (!evl){ return function(v){ (new Function(v))(); return null; }; } return function(v){ if (window.execScript){ window.execScript(v, 'JavaScript'); }else{ eval.call(null, v); } return null; }; } function rspJson(){ return function(v){ if (!v){ return null; } try { v = JSON.parse(v); }catch(e){ v = null; } return v; }; } function rspFunc(){ return function(v){ return new Function(v); }; } function rspCsv(spl){ var rx = new RegExp('(&quot;([^' + spl + ']*?)&quot;(?:\\s*' + spl + '|$)|\\'([^' + spl + ']*?)\\'(?:\\s*' + spl + '|$)|([^' + spl + ']+?)(?:\\s*' + spl + '|$))', 'g'); return function(v){ var t, w, z, vs = v.split(/[\\r\\n|\\n]/); for (var i=0;i&lt;vs.length;i++){ z = []; while ((t = rx.exec(vs[i])) !== null){ w = (t[2] != null)?t[2]:((t[3] != null)?t[3]:((t[4] != null)?t[4]:'')); z.push(w); } vs[i] = z; } return vs; }; } function nxSend(nx, fs, rl){ var o = nx._o, xhr = nx.__xhr, k; xhr.open(o.method, nx.__url, o.async, o.auth.user, o.auth.pw); if (o.async &amp;&amp; nx.__type){ xhr.responseType = nx.__type; } if (o.timeout != null){ xhr.timeout = o.timeout*1000; } for (k in o.headers){ if (o.headers.hasOwnProperty(k)) { xhr.setRequestHeader(k, o.headers[k]); } } if (nx._token !== null){ xhr.setRequestHeader(o.token, nx._token); } if (o.mime &amp;&amp; xhr.overrideMimeType){ xhr.overrideMimeType(o.mime); } if (fs){ nx.__start(rl, [xhr]); } if (nx._o.method === 'POST'){ if (o.contentType){ xhr.setRequestHeader('content-type', o.contentType); } xhr.send(postVs(nx._vs, nx._o.noescape)); }else{ xhr.send(); } } × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"global.html":{"id":"global.html","title":"Global","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Global Type Definitions assoc Assoc object. Type: object.&lt;string, *&gt; Source: common.define.js, line 3 Example { a: 1, b: '2', c: {c1: 1, c2: 2} } Class Class expression. Type: Object Source: common.define.js, line 24 Example - Class object functions Functions object. Type: object.&lt;string, function()&gt; Source: common.define.js, line 14 Example { a: function(v){ }, b: function(v){ } } × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"classes.list.html":{"id":"classes.list.html","title":"Classes","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Classes Classes Linker Nx Pager Reflector Relay RESTful Singular Tx Namespaces $najax define history $najax@class $najax@ex $najax@helper $najax@read $najax@rlk × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"namespaces.list.html":{"id":"namespaces.list.html","title":"Namespaces","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespaces Classes Linker Nx Pager Reflector Relay RESTful Singular Tx Namespaces $najax define history $najax@class $najax@ex $najax@helper $najax@read $najax@rlk × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorials.list.html":{"id":"tutorials.list.html","title":"Tutorials","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Tutorials Classes Linker Nx Pager Reflector Relay RESTful Singular Tx Namespaces $najax define history $najax@class $najax@ex $najax@helper $najax@read $najax@rlk × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"index.html":{"id":"index.html","title":"Index","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global najaxjs - Ajax simple library Features najaxjs. Ajax simple library. You can use ajax easily and customize request &amp; response behaviors. Supported response-type is raw text / json / jsonp / html / script / csv / or others...And it has many ajax options, async / sync / retry / timeout / cache / oth others by Nx object. Cross-domain requests supported by $najax.scriptTag / $najax.jsonpTag. There are various helper methods, $najax.url, $najax.query, $najax.submit.And helper classes, Singular, Pager, Reflector classes support 'ajax + ui'. $najax.history can easily operate url-history(push / replace / listen). Relay / Linker class. It can bundle responses. Requirements None. Any other library is unnecessary. (Only $najax.sendex method requires anyjs and jQuery library.) Browser Support Modern web-browsers(Chrome, IE, Firefox, Safari, Opera) support. IE browser: Support IE9. Loose support in IE8. (You can use most of the functions.) Legacy browser partially support. Basic usage(code example)// Ajax by $najax.request $najax.request(url).done(); // // Set request and response behaviors by Nx $najax.request(url).type('text').timeout(5).retry(3).done(); $najax.csv(url).done(); $najax.sync(url).param('stone', 'age').done(); // // It's possible to set success / fail / complete function $najax.request(url).success(sccs).complete(cmp).done(); $najax.request(url).fail(fail).complete(cmp).done(); $najax.request(url).done(sccs); // // // Others // See tutorials.Tutorials / Demos / ReferenceThere are many tutorials. Reference Tutorial Description Default ver Tiny ver RLK ver $najax static-najax.html $najax various methods tutorials. Yes Part - $najax@ex najax-ex.html $najax.send / $najax.sendex tutorials. Yes - - $najax@helper najax-helper.html $najax helper methods. Yes Yes - $najax@read najax-read.html $najax.require / $najax.load / $najax.module tutorials. Yes Yes - $najax@class najax-class.html Singular / Pager / Reflector class tutorials. Yes - - $najax.history static-history.html $najax.history tutorials. Yes - - Relay / Linker relaylinker.htmlrlk-standalone.html Relay and Linker class tutorials. Yes Yes Yes --- demo-ui-ajax.html Ajax and UI demo. Used various methods. - - - DistributionsFor detail, see reference. In dist directory, Distribution Introduction najax.js / najax.min.js Default version. najax-tiny.js / najax-tiny.min.js Tiny version. Not include the below.$najax.history$najax.send / $najax.sendex$najax.scriptTag / $najax.jsonpTag$najax@class(Singular, Pager, Reflector) rlk.js / rlk.min.js Relay / Linker standalone version. Ajax response typeSee Nx.type for detail. Type Description Value type json(*) Json. assoc raw Raw data. string text Text. text is same as raw. string html HTML. Element script Execute script. null func Function. function jsonp Jsonp. null csv Csv(Tsv). array xml Xml. XMLDocument blob Blob. Blob other XMLHttpRequest.responseType. Varies. Nx class specificationNx class. This class is created automatically by $najax various method. Specification Specify ajax request and response behaviors by Nx object. Specify by Nx object's various method or Nx opt method. Begin ajax connection by Nx done. Nx done returns Relay object. Relay provide operating response-data, and bundling multiple Relay. Nx implement ajax by using XMLHttpRequest. Relation library(any-js series) Library Introduction Requirements anyjs Basic methods and UI helper library. jQuery library najaxjs Simple ajax library. None nviewjs View template engine. jQuery library / anyjs LicenseReleased under the MIT license. See LICENSE. Links Online tutorial Github page × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax.html":{"id":"$najax.html","title":"Namespace: $najax","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: $najax $najax $najax(any-ajax) static methods. Provide various ajax methods. Method Default ver Tiny ver scriptTag Yes - jsonpTag Yes - Others Yes Yes RequiresAny other library is unnecessary.(Only $najax.sendex method requires any.js and jQuery library.) Specification Specify ajax request and response behaviors by Nx object. Specify by Nx object's various method or Nx opt method. Begin ajax connection by Nx done. Nx done returns Relay object. Relay provide operating response-data, and bundling multiple Relay. Nx implement ajax by using XMLHttpRequest. Source: najax.static.js, line 3 Tutorials: static-najax See: $najax.request Example $najax.request('path.php').done(); $najax.request('path.php', {a1:1,a2:2,a3:3}).done(function(data){ ... }); $najax.post('path.php', {a:1, b:2, c:3}).done(); $najax.post('path.php').param('a', 'A').param('b', 'B').done(); $najax.raw('path.php').done(); $najax.html('template.htm').done(function(el){ ... }); $najax.xml('xml.php').done(function(xml){ ... }); $najax.jsonp('jsonp.php', jsp_func).done(); $najax.sync('ajax.php').done(function(data){ ... }); $najax.script('script.php').done(); $najax.csv('list.csv').done(function(rows){ ... }); Namespaces define history Members &lt;static, readonly&gt; state :number Response state defines. Type: number Source: default/najax-ex.static.js, line 24 See: $najax.define.msg Methods &lt;static&gt; csv(url, vs, opt) CSV(TSV) response / ajax request. It's possible to specify csv-separator by separator option in Nx. Response value type Array Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 317 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.csv('list.csv').done(function(rows){ ... }); $najax.csv('list.tsv').opt('separator', &quot;\\t&quot;).done(function(rows){ ... }); &lt;static&gt; func(url, vs, opt) Function response / ajax request. This method don't execute script, pass function object to argument. Response value type function Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description cache boolean &lt;optional&gt; true Enable cache. Source: najax.static.js, line 235 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.func('script.php').done(function(fn){ ... }); $najax.func('script.php').success(function(fn){ ... }).done(); &lt;static&gt; get(url, vs, opt) GET ajax request. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 81 Tutorials: static-najax See: Nx Relay Linker $najax.request $najax.post Returns: Type Nx Example $najax.get('path.php').done(); $najax.get('path.php', {a1:1,a2:2,a3:3}).done(function(data){ ... }); &lt;static&gt; html(url, vs, opt) HTML response / ajax request. This method evaluate JavaScript in HTML. It's possible to specify root element by element option in Nx. Response value type Element Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description cache boolean &lt;optional&gt; true Enable cache. Source: najax.static.js, line 179 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.html('template.htm').done(function(el){ ... }); //Response arg is Element. $najax.html('template.php').success(function(el){ ... }).done(); $najax.html('template.php').opt('element', 'span').(function(el){ ... }).done(); //root element tag. $najax.html('template.php').opt('element', el).(function(el){ ... }).done(); //root element. &lt;static&gt; jsonp(url, fn, opt) Jsonp / ajax request. It's possible to specify jsonp-callback function by jsonp func in Nx. Response value type null Parameters: Name Type Argument Description url string URL. fn function | string Callback function. It must be global function. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 289 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.jsonp('jsonp.php', jsp_func).done(); $najax.jsonp('jsonp.php', 'jsp_func').done(); $najax.jsonp('jsonp.php', jsp_func).method('post').done(); $najax.jsonp('jsonp.php').jsonp(jsp_func, 'callback').param(vs).done(); &lt;static&gt; jsonpTag(url, fn, opt) Jsonp / tag request. Support outer cross-domain request. Only GET method. Note! Not included in najax-tiny.js. SpecificationSee $najax.scriptTag specification. Parameters: Name Type Argument Description url string URL. fn function | string Callback function. It must be global function. opt assoc &lt;optional&gt; Tx options. Source: default/najax-core-tag.js, line 606 Tutorials: static-najax See: Tx Relay Returns: Type Tx Example $najax.jsonpTag('script.php', jsp_func).done(); $najax.jsonpTag('script.php', 'jsp_func').charset('utf-8').done(); $najax.jsonpTag('script.php').jsonp(jsp_func, 'callback').done(); $najax.jsonpTag('script.php').param(vs).done(); $najax.jsonpTag('script.php').success(function(){ ... }).done(); &lt;static&gt; post(url, vs, opt) POST ajax request. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 106 Tutorials: static-najax See: Nx Relay $najax.request $najax.get Returns: Type Nx Example $najax.post('path.php', {a:1, b:2, c:3}).done(); $najax.post('path.php').param('a', 'A').param('b', 'B').done(); $najax.post('path.php', vs).done(function(data){ ... }); &lt;static&gt; raw(url, vs, opt) Raw(text) response / ajax request. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 131 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.raw('path.php').done(); $najax.raw('path.php', vs).done(function(data){ ... }); $najax.raw('path.php', vs).success(function(raw){ ... }).done(); &lt;static&gt; request(url, vs, opt) Simple ajax request. It's possible to specify ajax behaviors by using Nx object's method chaining. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 46 Tutorials: static-najax See: $najax.get $najax.post Nx Relay Returns: Type Nx Example $najax.request('path.php').done(); $najax.request('path.php', {a1:1,a2:2,a3:3}).done(function(data){ ... }); var nx = $najax.request('path.php');nx.param('a', 1).done(); $najax.request('path.php').type('raw').done(); $najax.request('path.php').success(function(){ ... }).fail(function(){ ... }).done(); $najax.request('path.php').retry(2).done(); $najax.request('path.php').async(false).timeout(30).done(); $najax.request('path.php').header('certify', 'mycode').done(); $najax.request('path.php').upload(element).done(); $najax.request('path.php').running(function(v){ ... }).complete(function(){ ... }).done(); &lt;static&gt; script(url, vs, opt) Script execute / ajax request. It's possible to specify evaluate mode, eval or function by iseval option in Nx. Response value type null Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description cache boolean &lt;optional&gt; true Enable cache. Source: najax.static.js, line 208 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.script('script.php').done(); $najax.script('script.php').opt('iseval', false).done(); //by function. &lt;static&gt; scriptTag(url, vs, opt) Script execute / tag request. Support outer cross-domain request. Only GET method. Note! Not included in najax-tiny.js. Specification Append SCRIPT tag. Load script and execute script. Remove SCRIPT tag. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET. opt assoc &lt;optional&gt; Tx options. Source: default/najax-core-tag.js, line 574 Tutorials: static-najax See: Tx Relay Returns: Type Tx Example $najax.scriptTag('script.php').done(); $najax.scriptTag('script.php', vs).done(); $najax.scriptTag('script.php').charset('utf-8').done(); $najax.scriptTag('script.php').success(function(){ ... }).done(); &lt;static&gt; sync(url, vs, opt) Ajax request with synchronization mode. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 343 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.sync('ajax.php').done(function(data){ ... }); var rl = $najax.sync('ajax.php').done(); var v = rl.value(); &lt;static&gt; text(url, vs, opt) Alias of $najax.raw. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 155 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.text('path.php').done(); $najax.text('path.php', vs).done(function(data){ ... }); $najax.text('path.php').success(function(text){ ... }).done(); &lt;static&gt; xml(url, vs, opt) XML response / ajax request. Response value type XMLDocument Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Source: najax.static.js, line 262 Tutorials: static-najax See: Nx Relay $najax.request Returns: Type Nx Example $najax.xml('xml.php').done(function(xml){ ... }); $najax.xml('xml.php', vs).done(function(xml){ ... }); $najax.xml('xml.php').param({a:1, b:1, c:3}).done(function(xml){ ... }); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax.define.html":{"id":"$najax.define.html","title":"Namespace: define","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: define $najax. define $najax defines. Source: common_base.js, line 3 Members &lt;static&gt; error :number Error mode. Value defines Value Description 0 none 1 error 2 error+trace Type: number Default Value: 1 Source: common_base.js, line 9 Example $najax.define.error = 2; &lt;static&gt; fail Default alert method for $najax.send. Source: default/najax-ex.static.js, line 73 See: $najax.state $najax.define.msg $najax@ex.send Example $najax.define.fail = function(state, msg, v){ alert(msg); }; &lt;static&gt; failAlert Alert method for connection error. Source: common_base.js, line 79 Example $najax.request(url).fail($najax.define.failAlert).done(); &lt;static&gt; failex Default fail-message method for $najax.sendex. SpecificationShow message by $any.floating.msg Source: default/najax-ex.static.js, line 144 See: $najax.define.msg $najax@ex.sendex Example $najax.define.failex = function(type, msg, v){ $any.floating.msg(msg, null, {css: 'error'}); } &lt;static&gt; msg :object Default messages for $najax.send / $najax.sendex. Type: object Properties: Name Type Argument Description 0 string &lt;optional&gt; Success. 1 string &lt;optional&gt; Connection error(ajax). 2 string &lt;optional&gt; Empty error(ajax). 3 string &lt;optional&gt; Verify error(ajax). 4 string &lt;optional&gt; App error(ajax). Source: default/najax-ex.static.js, line 46 See: $najax.state $najax@ex.send $najax@ex.sendex Example $najax.define.msg[0] = 'Success.'; &lt;static&gt; relaymode :number Default relay-data mode. It's possible to take out value by Relay object. Specify by 'Bitwise OR' value. Value defines Value Description 1 Args of complete function. Response value and XHR object. rl.value() rl.get() 2 Original data. User original data, etc. 4 Raw data. Ajax raw response. rl.data('_raw') Type: number Default Value: 3 (args + original data) Source: common_base.js, line 55 Example $najax.define.relaymode = 1; //args. $najax.define.relaymode = 3; //args + original data. $najax.define.relaymode = 6; //original data and raw data. &lt;static&gt; successex Default success-message method for $najax.sendex. SpecificationShow message by $any.floating.msg Source: default/najax-ex.static.js, line 120 See: $najax.define.msg $najax@ex.sendex Example $najax.define.successex = function(msg, v){ $any.floating.msg(msg); } &lt;static&gt; utms :string Identifier for disabling cache. Used by $najax.request and other various methods. Type: string Default Value: '__utms' Source: common_base.js, line 45 &lt;static&gt; verify Default verify method for $najax.send / $najax.sendex. Specificationfunction(v){ return (v.result == 1); } Source: default/najax-ex.static.js, line 96 See: $najax@ex.send $najax@ex.sendex Example $najax.define.verify = function(v){ return (v.result == 1); }; × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax.history.html":{"id":"$najax.history.html","title":"Namespace: history","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: history $najax. history Support history push and replace, listen. Note! Not included in najax-tiny.js. Method Default ver Tiny ver All methods Yes - Source: default/history.static.js, line 3 Tutorials: static-history Example //push $najax.history.push('?v=1'); $najax.history.push('?v=1', null, 'abc'); $najax.history.pushQuery(); //replace $najax.history.replace('?v=1'); $najax.history.replace('?v=1', null, 'abc', {data: {v: 2}}); $najax.history.replaceQuery('abc', {v: 2}); //listen $najax.history.listen(function(e, id, vs, title){ ... }); //init $najax.history.replaceListen(function(e, id, vs, title){ ... }); Methods &lt;static&gt; init(fn, id, title, opt) Replace &amp; replace now. Parameters: Name Type Argument Default Description fn function Callback function. function(e:event, title:string, vs:assoc){ ... } id string | integer &lt;optional&gt; null Page's id. title string &lt;optional&gt; null Title. opt assoc &lt;optional&gt; Options. $najax.history.listen, $najax.history.replace's options. Properties Name Type Argument Default Description data assoc &lt;optional&gt; null Passed values. Source: default/history.static.js, line 216 Tutorials: static-history Example $najax.history.replaceListen(function(e, id, title, data){ ... }, id); &lt;static&gt; listen(fn, opt) Listen to event of browser's back and prev. Parameters: Name Type Argument Description fn function Callback function. function(e:event, title:string, vs:assoc){ ... } opt assoc &lt;optional&gt; Options. Properties Name Type Argument Default Description title boolean &lt;optional&gt; true Change title automatically. Source: default/history.static.js, line 176 Tutorials: static-history Example $najax.history.listen(function(e, id, title, data){ ... }); &lt;static&gt; push(url, id, title, opt) Push new page's url and title, values. Recommend to use this method with $najax.history.listen. Parameters: Name Type Argument Default Description url string URL. id string | integer &lt;optional&gt; null Page's id. title string &lt;optional&gt; null Title. opt assoc &lt;optional&gt; Options. Properties Name Type Argument Default Description data assoc &lt;optional&gt; null Passed values. store assoc &lt;optional&gt; true Store first page's data by $najax.history.replace. legacy function &lt;optional&gt; null Legacy browser's behaviors. Ex: function(url, title, vs){location.href = url;} Source: default/history.static.js, line 42 Tutorials: static-history See: $najax.history.pushQuery Example $najax.history.push('?v=1'); $najax.history.push('?v=1', id, 'abc', {data: {v: 2}}); $najax.history.push('?v=1', null, null, {legacy: function(url, id, title, vs){ ... } }); &lt;static&gt; pushQuery(id, title, vs, opt) Push new page's url and title, values. Support query-string. Recommend to use this with $najax.history.listen. Parameters: Name Type Argument Default Description id string | integer &lt;optional&gt; null Page's id. title string &lt;optional&gt; null Title. If null, set now title. vs assoc &lt;optional&gt; null Passed values. URL's query-string values is overrided by this values. opt assoc &lt;optional&gt; Options. $najax.history.push options. Source: default/history.static.js, line 83 Tutorials: static-history See: $najax.history.pushQuery Example $najax.history.pushQuery(); $najax.history.pushQuery(id, 'abc', vs, {data: {v: 2}}); $najax.history.pushQuery(null, 'abc', null, {title: false}); &lt;static&gt; replace(url, id, title, opt) Replace now page's url and title, values. Parameters: Name Type Argument Default Description url string &lt;optional&gt; URL. If null, prepare now url. id string | integer &lt;optional&gt; null Page's id. title string &lt;optional&gt; null Title. If null, set now title. opt assoc &lt;optional&gt; Options. Properties Name Type Argument Default Description data assoc &lt;optional&gt; null Passed values. legacy function &lt;optional&gt; null Legacy browser's behaviors. Ex: function(url, title, vs){location.replace = url;} Source: default/history.static.js, line 108 Tutorials: static-history See: $najax.history.replaceQuery Example $najax.history.replace('?v=1'); $najax.history.replace('?v=1', id, 'abc', {data: {v: 2}}); $najax.history.replace('?v=1', null, null, {legacy: function(url, id, title, vs){ ... } }); &lt;static&gt; replaceQuery(id, title, vs, opt) Replace now page's url and title, values. Support query-string. Parameters: Name Type Argument Default Description id string | integer &lt;optional&gt; null Page's id. title string &lt;optional&gt; null Title. If null, set now title. vs assoc &lt;optional&gt; null Passed values. URL's query-string values is overrided by this values. opt assoc &lt;optional&gt; Options. $najax.history.replace options. Source: default/history.static.js, line 151 Tutorials: static-history See: $najax.history.replace Example $najax.history.replaceQuery(); $najax.history.replaceQuery(id, 'abc', vs, {data: {v: 2}}); $najax.history.replaceQuery(null, 'abc', null, {title: false}); &lt;static&gt; state() Get history.state. Source: default/history.static.js, line 240 Tutorials: static-history Returns: Type assoc Example vs = $najax.history.state(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax@class.html":{"id":"$najax@class.html","title":"Namespace: $najax@class","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: $najax@class $najax@class $najax helper class. Note! Not included in najax-tiny.js. Method Default ver Tiny ver All methods Yes - Source: default/najax-class.static.js, line 3 Tutorials: najax-class demo-ui-ajax See: Singular Pager Reflector Example var Singular = $najax.Singular(); var Pager = $najax.Pager(); var Reflector = $najax.Reflector(); Methods &lt;static&gt; Pager() Pager-class builder. Source: default/najax-class.static.js, line 470 Tutorials: najax-class See: Pager Returns: Pager class. Type Pager Example var Pager = $najax.Pager(); var pager = new Pager(function(n, len){... $najax.get('send.php', {n: n, len: len}) ... }); pager.len(15); //set length of page's items pager.current(); //current pager.move(5); //move pager.prev(); //prev pager.next(); //next pager.data(); //get data pager.data({all: 100, n:1}); //set data pager.func(fn); //set function &lt;static&gt; Reflector() Reflector-class builder. Source: default/najax-class.static.js, line 750 Tutorials: najax-class demo-ui-ajax See: Reflector Returns: Reflector class. Type Reflector Example var reflector = new ($najax.Reflector()); reflector.render('#target', url); reflector.render('#target', url, {v: v}); reflector.render('#target', url, null, function(v){ ... return v; }); var Reflector = $najax.Reflector(); var nx = $najax.get(null).timeout(5); var reflector = new Reflector(nx); reflector.type('html').render('#target', url); reflector.typeJson(function(v){ ... return v;}).render('#target', url); reflector.type('json').render('#target', url, null, function(v){ return this.list(v.list, function(k, v){ ... return v;}); }); &lt;static&gt; RESTful() RESTful-class builder. Source: default/najax-class.static.js, line 88 Tutorials: najax-class demo-ui-ajax See: RESTful Returns: RESTful class. Type RESTful &lt;static&gt; Singular() Singular class builder. Source: default/najax-class.static.js, line 228 Tutorials: najax-class demo-ui-ajax See: Singular Returns: Singular class. Type Singular Example var Singular = $najax.Singular(); var singular = new Singular(); single.caller(function(){ ... return rl; }); Set caller. single.kick(); //Begin. btn.onclick = single.kicker(); //Begin. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax@ex.html":{"id":"$najax@ex.html","title":"Namespace: $najax@ex","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: $najax@ex $najax@ex Ajax request with verifying automatically and showing messages. Note! Not included in najax-tiny.js. Method Default ver Tiny ver All methods Yes - Source: default/najax-ex.static.js, line 3 Tutorials: najax-ex Example $najax.send('path.php').done(); $najax.send('path.php', null, {verify: $najax.define.verify}).done(); $najax.send('path.php', null, {verify: function(v){ return (v.verify)?true:false; } }).done(); $najax.sendex('path.php').done(); $najax.sendex('path.php', null, {verify: $najax.define.verify}).done(); Methods &lt;static&gt; send(url, vs, opt) Simple ajax request with verifying automatically and showing messages. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description success function &lt;optional&gt; null Success function. fail function &lt;optional&gt; $najax.define.fail Fail function. verify function &lt;optional&gt; null Verify function. If null, not verify. Ex: {verify: $najax.define.verify} msg assoc &lt;optional&gt; $najax.define.msg Messages. Source: default/najax-ex.static.js, line 195 Tutorials: najax-ex See: $najax.define.fail $najax.define.verify $najax.define.msg $najax.request Returns: Type Nx Example $najax.send('path.php').done(); $najax.send('path.php', null, {verify: $najax.define.verify}).done(); $najax.send('path.php', null, {verify: function(v){ return (v.verify)?true:false; } }).done(); $najax.send('path.php', null, {msg: {0: 'OK', 4: 'Application error!!'} }).done(); &lt;static&gt; sendex(url, vs, opt) Ajax request with verifying automatically and showing messages by $any.floating.msg, showing loading message. RequiresjQuery / any.js Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameters for GET / POST. opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description success function &lt;optional&gt; $najax.define.successex Success function. fail function &lt;optional&gt; $najax.define.failex Fail function. verify function &lt;optional&gt; null Verify function. If null, not verify. Ex: {verify: $najax.define.verify} msg assoc &lt;optional&gt; $najax.define.msg Messages. loading string &lt;optional&gt; 'loading' Loading CSS name. Source: default/najax-ex.static.js, line 235 Tutorials: najax-ex See: $najax.define.successex $najax.define.failex $najax.define.verify $najax.define.msg $najax@ex.send $najax.request Returns: Type Nx Example $najax.sendex('path.php').done(); $najax.sendex('path.php', null, {verify: $najax.define.verify}).done(); $najax.sendex('path.php', null, {verify: function(v){ return (v.verify)?true:false; } }).done(); $najax.sendex('path.php', null, {msg: {0: 'OK', 4: 'Application error!!'} }).done(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax@helper.html":{"id":"$najax@helper.html","title":"Namespace: $najax@helper","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: $najax@helper $najax@helper $najax helper methods. Method Default ver Tiny ver All methods Yes Yes Source: najax-helper.static.js, line 3 Tutorials: najax-helper Example v = $najax.escape(1); v = $najax.escape('E=M+C+2'); url = $najax.url('ajax.php', {a:1, b:2, c:3}); url = $najax.url('ajax.php', {a:1, b:2}, true); qs = $najax.query(true); $najax.parseHTML(el, html); $najax.submit('form.php', vs); $najax.submit('form.php', vs, {method: 'POST', target: '_blank'}); $najax.iframeHtml(el, '&lt;div&gt;content&lt;/div&gt;'); Methods &lt;static&gt; escape(v) Escape value. Parameters: Name Type Description v string Parameter value. Source: najax-helper.static.js, line 56 Tutorials: najax-helper See: $najax.params $najax.url Returns: Type string Example v = $najax.escape(1); v = $najax.escape('E=M+C+2'); v = $najax.escape('K V S'); &lt;static&gt; hash() Get hash. Source: najax-helper.static.js, line 214 Tutorials: najax-helper Returns: Type string Example hash = $najax.hash(); &lt;static&gt; iframeHtml(el, src, opt) Create iframe content by source. Parameters: Name Type Argument Description el Element Iframe Element. src string HTML source. opt assoc &lt;optional&gt; Option. Properties Name Type Argument Default Description all boolean &lt;optional&gt; false If true, all content mode. or false, body content mode. charset string &lt;optional&gt; 'utf-8' Charset. css string &lt;optional&gt; '' CSS Style. js string &lt;optional&gt; '' JavaScript source. Source: najax-helper.static.js, line 370 Tutorials: najax-helper Example $najax.iframeHtml(el, '&lt;div&gt;content&lt;/div&gt;'); $najax.iframeHtml(el, '&lt;html&gt;....&lt;/html&gt;', {all: true}); $najax.iframeHtml(el, src, {css: 'body: {font-size:12pt;}'}); $najax.iframeHtml(el, src, {js: 'alert(&quot;demo&quot;);'}); &lt;static&gt; params(vs, noescape) Return string values. Parameters: Name Type Argument Default Description vs assoc Parameter values. noescape boolean &lt;optional&gt; false If true, not escape values. Source: najax-helper.static.js, line 110 Tutorials: najax-helper See: $najax.escape $najax.url Returns: Type string Example v = $najax.params({a: 1}); v = $najax.params({a: 1, b:2}, true); v = $najax.params({K:'V S', E:'M C'}); &lt;static&gt; parseHTML(el, src) Parse HTML with evaluating JavaScript. Parameters: Name Type Description el Element Destination element. src string HTML source. Source: najax-helper.static.js, line 294 Tutorials: najax-helper Example $najax.parseHTML(el, html); &lt;static&gt; query(hash) Parse query string and return parameter assoc. Parameters: Name Type Argument Default Description hash boolean &lt;optional&gt; false If true, include URL's hash fragment(#). Source: najax-helper.static.js, line 188 Tutorials: najax-helper Returns: Type assoc Example qs = $najax.query(); &lt;static&gt; submit(url, vs, opt) Submit values by form Element. Parameters: Name Type Argument Default Description url string URL. vs assoc &lt;optional&gt; null Parameter. opt assoc &lt;optional&gt; Option. Properties Name Type Argument Default Description form Element &lt;optional&gt; Form Element. method string &lt;optional&gt; null Method(GET | POST). target string &lt;optional&gt; Target window. enctype string &lt;optional&gt; Form enctype. Source: najax-helper.static.js, line 313 Tutorials: najax-helper Returns: Type Element Example $najax.submit('form.php', vs); $najax.submit('form.php', vs, {method: 'POST', target: '_blank'}); $najax.submit('form.php', vs, {form: '#form', target: '_blank'}); &lt;static&gt; url(url, vs, noescape) Create url by params. URL's query-string value is overridden by parameter-values. Parameters: Name Type Argument Default Description url string URL. vs assoc Parameter values. noescape boolean &lt;optional&gt; false If true, not escape values. Source: najax-helper.static.js, line 141 Tutorials: najax-helper See: $najax.escape $najax.params Returns: Type string Example url = $najax.url('ajax.php', {a:1, b:2, c:3}); url = $najax.url('ajax.php', {a:1, b:2}, true); url = $najax.url('ajax.php?a=0&amp;d=3', {a:1, b:2, c:3}); url = $najax.url('ajax.php?a=x+y&amp;', {a:'NX', b: 'E=M+C+2', d:'K V S'}); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax@read.html":{"id":"$najax@read.html","title":"Namespace: $najax@read","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: $najax@read $najax@read $najax read methods. Method Default ver Tiny ver All methods Yes Yes Source: najax-read.static.js, line 3 Tutorials: najax-read Example $najax.require('sample.js'); $najax.require(['s1.js', 's2.js'], {base: 'path/'}).done(function(s1, s2){ ... }); $najax.ready(function(){ ... }); $najax.load('#target', 'demo.php', {a: 1, b: 2}); $najax.module('template.php'); Methods &lt;static&gt; load(el, url, vs, opt) Load template and append HTML and JS to Element. If target Element is null, append to document bottom(auto-append). SpecificationNaming in auto-append: prefix + CRC code created by url. Ex: id=njx5690_elem by Relay::data is Element. Parameters: Name Type Argument Default Description el Element Element. If null, append automatically as a last Element - auto-append. url string URL vs assoc &lt;optional&gt; null Parameter opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description prefix string &lt;optional&gt; 'njx' When appending to as last Element, it's possible to specify Element's id prefix. relaymode number &lt;optional&gt; 3 For details, see $najax.define.relaymode. Source: najax-read.static.js, line 104 Tutorials: najax-read See: $najax.module $najax.define.relaymode Nx Relay Linker Returns: Type Linker Example $najax.load('#target', 'demo.php', {a: 1, b: 2}); $najax.load(null, 'demo.php').done(function(data){ ... }); &lt;static&gt; module(url, opt) Load module - Wrapper of $najax.load. Append to document bottom. SpecificationAppend module(HTML and script) to document bottom. Parameters: Name Type Argument Description url string URL opt assoc &lt;optional&gt; $najax.load options. Source: najax-read.static.js, line 155 Tutorials: najax-read See: $najax.load Nx Relay Linker Returns: Type Linker Example $najax.module('template.php'); &lt;static&gt; ready(fn) Ready function for $najax.require. Parameters: Name Type Description fn function Function. Source: najax-read.static.js, line 83 Tutorials: najax-read See: $najax.require Example $najax.ready(function(){ ... }); $najax.ready($any.makeClass( ... )); &lt;static&gt; require(path, opt) Load script and pass function object by $najax.ready to arguments. Parameters: Name Type Argument Description path string | array Path or Paths. opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description base string &lt;optional&gt; '' Base path. run boolean &lt;optional&gt; false Run script after loading. relaymode number &lt;optional&gt; 2 For details, see $najax.define.relaymode. cache boolean &lt;optional&gt; true Enable cache. Source: najax-read.static.js, line 31 Tutorials: najax-read See: $najax.ready $najax.define.relaymode Nx Relay Linker Returns: Type Linker Example $najax.require('sample.js'); $najax.require(['s1.js', 's2.js'], {base: 'path/'}).done(function(s1, s2){ ... }); $najax.require(['AClass.js', 'BClass.js']).done(function(AClass, BClass){ ... }); $najax.require('sample.js', {run: true}); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"$najax@rlk.html":{"id":"$najax@rlk.html","title":"Namespace: $najax@rlk","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Namespace: $najax@rlk $najax@rlk Relay / Linker class. It's possible to operate response-data and behaviors after completed.Provide 'Data-relay' and 'Abort', 'Bundle multiple Relay object by Linker'. Method Default ver Tiny ver All methods Yes Yes Source: relaylinker.static.js, line 3 Tutorials: relaylinker rlk-standalone See: Relay Linker Example var rl1 = $najax.request.done(); //Relay object. var rl2 = $najax.post.done(); //Relay object. $rlk.linker(rl1, r2).done(function(){ ... }); var rl1 = new ($najax.RelayClass()); $najax.linker(rl, r2).success(function{ ... }).done(); var rl1 = new ($rlk.RelayClass()); $rlk.linker(rl, r2).success(function{ ... }).done(); var rl12 = $rlk.linker(rl1, r2).done(); $rlk.linker(rl3, rl12).done(function(){ ... }); Methods &lt;static&gt; linker(rl) Bundle Relay object. And providing result methods. Parameters: Name Type Argument Description rl Relay &lt;optional&gt; &lt;repeatable&gt; Relay object. Source: relaylinker.static.js, line 744 Tutorials: relaylinker rlk-standalone See: Relay Linker Returns: Linker object. Type Linker Example $najax.linker(rl).success(function(){ ... }); $najax.linker(rl).success(function{ ... }).fail(function{ ... }).done(function(){ ... }); $najax.linker(rl).done(function(){ ... }); $najax.linker(rl1, rl2, rl3).done(function(r1, r2, r3){ ... }); $najax.linker(rl1, rl2, rl3).argument('value').done(function(v1, v2, v3){ ... }); $najax.linker(rl1).argument('first').done(function(v, obj, type){ ... }); var linker = $najax.linker(rl).done();linker.clear(); $rlk.linker(rl1, rl2, rl3); //standalone &lt;static&gt; LinkerClass() Return Linker class. Source: relaylinker.static.js, line 799 Tutorials: relaylinker rlk-standalone See: Relay Linker Returns: Linker class. Type Linker Example Linker = $najax.linkerClass(); Linker = $rlk.linkerClass(); //standalone &lt;static&gt; RelayClass() Return Relay class. Source: relaylinker.static.js, line 777 Tutorials: relaylinker rlk-standalone See: Relay Linker Returns: Linker class. Type Linker Example Relay = $najax.relayClass(); Relay = $rlk.relayClass(); //standalone × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Linker.html":{"id":"Linker.html","title":"Class: Linker","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Linker Linker new Linker() Linker class. Provide 'data relay' and 'abort', 'bundle multiple relay object by Linker'. Linker bundle Relay. Method Default ver Tiny ver All methods Yes Yes Source: relaylinker.static.js, line 482 Tutorials: relaylinker rlk-standalone See: Relay Example Linker = $najax.linkerClass(); Linker = $rlk.linkerClass(); //standalone Methods abort() Abort all Relay objects. Source: relaylinker.static.js, line 706 Returns: Type Linker Example linker.abort(); argument(type) Set argument type. Argument typesfirst First relay's arguments.value Value of first argument.data Original data.relay(default) Relay object. Parameters: Name Type Description type string Argument type. Source: relaylinker.static.js, line 539 Returns: Type Linker Example linker.argument('value').done(function(v1, v2){ ... }); linker.argument('first').done(function(v, x, y){ ... }); linker.argument('data').done(function(data1, dat2){ ... }); linker.argument('relay').done(function(rl1, rl2){ ... }); //default $najax.linker(rl).argument('value').done(function(v1){ ... }); rlk.linker(rl).argument('value').done(function(v1){ ... }); clear() Clear all Relay objects and clear values. Source: relaylinker.static.js, line 685 Example linker.clear(); complete(fn) Set complete function. Parameters: Name Type Description fn function Complete function. Source: relaylinker.static.js, line 622 See: Linker#success Linker#fail Linker#done Returns: Type Linker Example linker.complete(fn); done(success, fail, complete) Set function and return Relay object. Parameters: Name Type Argument Description success function &lt;optional&gt; Success function. fail function &lt;optional&gt; Fail function. complete function &lt;optional&gt; Complete function. Source: relaylinker.static.js, line 645 See: Linker#success Linker#fail Linker#complete Returns: Relay object. Type Relay Example linker.done(); linker.done(success); linker.done(success, fail ,complete); fail(fn) Set fail function. Parameters: Name Type Description fn function Fail function. Source: relaylinker.static.js, line 599 See: Linker#success Linker#complete Linker#done Returns: Type Linker Example linker.fail(fn); init() Initialize all Relay objects. Source: relaylinker.static.js, line 514 Returns: Type Linker Example linker.init(); lock() Lock. Source: relaylinker.static.js, line 727 Returns: Type Linker Example linker.lock(); success(fn) Set success function. Parameters: Name Type Description fn function Success function. Source: relaylinker.static.js, line 576 See: Linker#fail Linker#complete Linker#done Returns: Type Linker Example linker.success(fn); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Nx.html":{"id":"Nx.html","title":"Class: Nx","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Nx Nx new Nx(opt) Nx class. This class is created automatically by $najax various method. Method Default ver Tiny ver All methods Yes Yes Specification Specify ajax request and response behaviors by Nx object. Specify by Nx object's various method or Nx opt method. Begin ajax connection by Nx done. Nx done returns Relay object. Relay provide operating response-data, and bundling multiple Relay. Nx implement ajax by using XMLHttpRequest. Parameters: Name Type Argument Description opt assoc &lt;optional&gt; Nx options. Properties Name Type Argument Default Description method string &lt;optional&gt; 'GET' Method. GET / POST type string &lt;optional&gt; 'json' Response type. async boolean &lt;optional&gt; true Enable async. cache boolean &lt;optional&gt; false Enable cache. retry number &lt;optional&gt; null Retry number. timeout number &lt;optional&gt; null Timeout ms. filter function &lt;optional&gt; null Response value filter. contentType string &lt;optional&gt; 'application/x-www-form-urlencoded' Method POST option. It's possbile to specify content-type. mime string &lt;optional&gt; null Mime by XHR. headers assoc &lt;optional&gt; {} HTTP Headers. token string &lt;optional&gt; 'X-CSRF-Token' HTTP Header of CSRF token. noescape boolean &lt;optional&gt; false If true, not escape parameters. Apply to GET or POST parameters. jsonp assoc &lt;optional&gt; Jsonp option. Properties Name Type Argument Default Description callback string | function &lt;optional&gt; '' Jsonp callback function. name string &lt;optional&gt; 'callback' Jsonp callback variable name. element string | Element &lt;optional&gt; 'div' Type html option. Root element or element tag name. iseval boolean &lt;optional&gt; true Type script option. Determine to use eval. if false, use function. separator string &lt;optional&gt; ',' Type csv option. Separator. auth assoc &lt;optional&gt; Auth option. Properties Name Type Argument Default Description user string &lt;optional&gt; null User name. pw string &lt;optional&gt; null Password. relaymode number &lt;optional&gt; $najax.define.relaymode Data relaymode. See $najax.define.relaymode for detail. clean boolean &lt;optional&gt; true Clear object's values after completed. Source: najax-core.js, line 180 Tutorials: static-najax See: $najax.request Example $najax.request(url).done(); $najax.post(url).param(vs).done(); $najax.raw(url).done(function(){ ... }); $najax.script(url).success(function(){ ... }).done(function(){ ... }); var rl = $najax.html(url).done(); Methods abort() Abort ajax. Source: najax-core.js, line 929 Tutorials: static-najax Returns: Type Nx Example nx.abort(); async(on) Set async or sync. Parameters: Name Type Description on boolean Async flag. Default Value: true Source: najax-core.js, line 395 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).async(false).done(); //sync auth(user, pw) Set auth. Parameters: Name Type Description user string User name. pw string Password. Source: najax-core.js, line 669 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).auth('user', 'password').done(); begin(fn) Set begin function. Function specificationCalled before beginning ajax. Function structurefunction(xhr:XMLHttpRequest){ ... } this: Relay object Parameters: Name Type Description fn function Begin function. Source: najax-core.js, line 730 Tutorials: static-najax See: Nx#success Nx#fail Nx#complete Nx#running Nx#done Returns: Type Nx Example $najax.request(url).begin(function(){ ... }).done(); cache(on) Set cache behavior. Parameters: Name Type Description on boolean Determine to cache. Default Value: false Source: najax-core.js, line 400 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).cache(true).done(); clean(on) Set clear behavior. Parameters: Name Type Description on boolean Determine to clear. If true, clear object's values after completed. Default Value: true Source: najax-core.js, line 674 Tutorials: static-najax See: Nx#clear Returns: Type Nx Example var nx = $najax.request(url).clean(false);nx.done(); //not clear clear() Clear object's values after completed. Source: najax-core.js, line 945 Tutorials: static-najax Example nx.clear(); complete(fn) Set complete function. Function specificationCalled after ajax completed, both success and fail. Function structurefunction(v:*, xhr:XMLHttpRequest){ ... } this: Relay object Parameters: Name Type Description fn function Complete function. Source: najax-core.js, line 817 Tutorials: static-najax See: Nx#begin Nx#success Nx#fail Nx#running Nx#done Returns: Type Nx Example $najax.request(url).complete(function(v, xhr){ ... }).done(); contentType(contentType, mime) Set content-type and mime. Method POST option. Parameters: Name Type Description contentType string Content-type. mime string Mime. Default Value: 'application/x-www-form-urlencoded' Source: najax-core.js, line 516 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).contentType('application/x-www-form-urlencoded').done(); done(success, fail, complete) Set success / fail / complete, and begin ajax. Parameters: Name Type Argument Description success function &lt;optional&gt; Success function. See Nx.success. fail function &lt;optional&gt; Fail function. See Nx.fail. complete function &lt;optional&gt; Complete function. See Nx.complete. Source: najax-core.js, line 899 Tutorials: static-najax See: Nx#begin Nx#success Nx#fail Nx#complete Nx#running Returns: Relay object. Type Relay Example $najax.request(url).done(); $najax.request(url).done(function{ ... }); $najax.request(url).done(null, function{ ... }); $najax.request(url).done(null, null, function{ ... }); fail(fn) Set fail function. Function specificationCalled when ajax fail. ex: network error, 403, 404, 503 or any other HTTP error. Function structurefunction(state:number, xhr:XMLHttpRequest){ ... } this: Relay object Parameters: Name Type Description fn function Fail function. Source: najax-core.js, line 788 Tutorials: static-najax See: Nx#begin Nx#success Nx#complete Nx#running Nx#done Returns: Type Nx Example $najax.request(url).fail(function(state, xhr){ ... }).done(); filter(fn) Set filter function. It's possible to modify response-value. Function specificationCalled after recieving data and before making response-value. Function structurefunction(v:string){ return v; } Parameters: Name Type Description fn function Filter function. Source: najax-core.js, line 476 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).filter(function(v){ return v; }).done(); header(w, v) Set HTTP Headers. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: najax-core.js, line 543 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).header('abc', 'ABC').done(); $najax.request(url).header({abc: 'ABC'}).done(); jsonp(callback, name) Set jsonp option. Parameters: Name Type Argument Default Description callback string | function &lt;optional&gt; Jsonp callback function. name string &lt;optional&gt; 'callback' Jsonp callback variable name. Source: najax-core.js, line 481 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).type('jsonp').jsonp('func').done(); $najax.request(url).type('jsonp').jsonp(func).done(); $najax.request(url).type('jsonp').jsonp(func, 'callback').done(); method(method) Set method. GET / POST Method | Method | Description | Related method or option || GET(*) | Http GET. | Nx.paramopt.noescape || POST | Http POST. | Nx.paramopt.noescapeopt.contentType | Parameters: Name Type Description method string Method. GET / POST Default Value: 'GET' Source: najax-core.js, line 304 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).method('get').done(); $najax.request(url).method('post').done(); opt(w, v) Set opt value. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: najax-core.js, line 711 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).opt('noescape', true).done(); $najax.request(url).opt('relaymode', 1).done(); $najax.request(url).opt({element: 'div'}).done(); param(w, v) Set param. GET: URL parameters, POST: POST parameters. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: najax-core.js, line 362 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).param('a', 1).param('b', 1).done(); $najax.request(url).param({a: 1, b:2, c:3}).done(); progress(download, upload) Set download and upload progress function. Function structurefunction(e:ProgressEvent, rate:number, xhr:XMLHttpRequest){ ... } rate: [0.0 - 1.0] Parameters: Name Type Argument Default Description download function &lt;optional&gt; null Download progress function. upload function &lt;optional&gt; null Upload progress function. Source: najax-core.js, line 643 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).progress(dl, up).done(); $najax.request(url).progress(dl).done(); relay(w, v) Set relay original data. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: najax-core.js, line 693 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).relay('a', 1).relay('b', 2).done(); $najax.request(url).relay({a:1, b:2}).done(); retry(n) Set retry number. Parameters: Name Type Description n number Retry number. Default Value: null Source: najax-core.js, line 418 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).retry(2).done(); running(fn) Set running function. Function specificationCalled when begin(state=true) and complete(state=false). Function structurefunction(state:boolean){ ... } this: Relay object Parameters: Name Type Description fn function Running function. Source: najax-core.js, line 846 Tutorials: static-najax See: Nx#begin Nx#success Nx#fail Nx#complete Nx#done Returns: Type Nx Example $najax.request(url).running(function(state){ ... }).done(); success(fn) Set success function. Function specificationCalled when ajax succeed. ex: HTTP code 200. Function structurefunction(v:*, xhr:XMLHttpRequest){ ... } this: Relay object Parameters: Name Type Description fn function Success function. Source: najax-core.js, line 759 Tutorials: static-najax See: Nx#begin Nx#fail Nx#complete Nx#running Nx#done Returns: Type Nx Example $najax.request(url).success(function(v, xhr){ ... }).done(); timeout(s) Set timeout ms. Parameters: Name Type Description s number Timeout ms. Default Value: null Source: najax-core.js, line 451 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).timeout(500).done(); token(v) Set CSRF token. Parameters: Name Type Argument Description v string &lt;optional&gt; CSRF token value. Source: najax-core.js, line 566 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).token('Zvds1yfe.f3iF9y4FfsJeMJKlyqYdJ.duJgMi').done(); type(type) Set response type. Response type Type Description Value type Related method or option json(*) Json. assoc raw Raw data. string text Text. text is same as raw. string html HTML. Element opt.element script Execute script. null opt.iseval func Function. function jsonp Jsonp. null Nx.jsonp csv Csv(Tsv). array opt.separator xml Xml. XMLDocument blob Blob. Blob other XMLHttpRequest.responseType. Varies. Parameters: Name Type Description type string Response type. Default Value: 'json' Source: najax-core.js, line 309 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).type('raw').done(); $najax.request(url).type('html').done(); $najax.request(url).type('script').done(); upload(v) Set upload object. Support Form(Element) and input(type=file)(Element), FormData. Parameters: Name Type Description v Element | FormData Form(Element) / input(type=file)(Element) / FormData. Source: najax-core.js, line 586 Tutorials: static-najax Returns: Type Nx Example $najax.request(url).upload(input).done(); $najax.request(url).upload(form).done(); url(url) Set url. Parameters: Name Type Description url string URL. Source: najax-core.js, line 346 Tutorials: static-najax Returns: Type Nx Example $najax.request(null).url(url).done(); xhr() Get XHR object. Source: najax-core.js, line 964 Returns: Type XMLHttpRequest Example var nx = $najax.request(url);nx.done(); var xhr = nx.xhr(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Pager.html":{"id":"Pager.html","title":"Class: Pager","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Pager Pager new Pager(fn, len, opt) Pager class. Provide paging methods. Method Default ver Tiny ver All methods Yes - Parameters: Name Type Argument Description fn function &lt;optional&gt; Callback function. len number &lt;optional&gt; Item length. opt assoc &lt;optional&gt; Option. Properties Name Type Argument Default Description n string &lt;optional&gt; 'n' Variable name of page number. len string &lt;optional&gt; 'len' Variable name of item length. all string &lt;optional&gt; 'all' Variable name of all item length. Source: default/najax-class.static.js, line 253 Tutorials: najax-class demo-ui-ajax See: $najax@class.Pager Example var Pager = $najax.Pager(); var pager = new Pager(function(n, len){... $najax.get('send.php', {n: n, len: len}) ... }); var pager = new Pager(null, null, {n: 'pg'}); pager.len(15); //set length of page's items pager.current(); //current pager.move(5); //move pager.prev(); //prev pager.next(); //next pager.data(); //get data pager.data({all: 100, n:1}); //set data pager.func(fn); //set function Methods current() Current. Source: default/najax-class.static.js, line 323 Tutorials: najax-class Example pager.current(); data(data) Set data or get data. Parameters: Name Type Argument Description data assoc &lt;optional&gt; Data. {n:n, len:len, all: all} Source: default/najax-class.static.js, line 388 Tutorials: najax-class Returns: assoc {n:n, len:len, all: all, max: max} Type void | assoc Example pager.data(data); data = pager.data(); func(fn) Set function. Parameters: Name Type Description fn function Function. Source: default/najax-class.static.js, line 423 Tutorials: najax-class Example pager.func(fn); len(v) Set item-length or get item-length. Parameters: Name Type Argument Description v number &lt;optional&gt; Item length. Source: default/najax-class.static.js, line 300 Tutorials: najax-class Returns: Type void | number Example pager.len(v); len = pager.len(); move(v) Move. Parameters: Name Type Argument Description v number &lt;optional&gt; Page number. Source: default/najax-class.static.js, line 338 Tutorials: najax-class Example pager.move(v); next() Next. Source: default/najax-class.static.js, line 372 Tutorials: najax-class Example pager.next(); prev() Previous. Source: default/najax-class.static.js, line 356 Tutorials: najax-class Example pager.prev(); update() Update state. Source: default/najax-class.static.js, line 440 Tutorials: najax-class Example pager.update(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Reflector.html":{"id":"Reflector.html","title":"Class: Reflector","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Reflector Reflector new Reflector(nx) Reflector class. Provide ajax request and reflect to content. Method Default ver Tiny ver All methods Yes - Parameters: Name Type Argument Default Description nx Nx &lt;optional&gt; null Nx object. If null, Create Nx object automatically. Source: default/najax-class.static.js, line 498 Tutorials: najax-class demo-ui-ajax See: $najax@class.Reflector Example var reflector = new ($najax.Reflector()); reflector.render('#target', url); reflector.render('#target', url, {v: v}); reflector.render('#target', url, null, function(v){ ... return v; }); var Reflector = $najax.Reflector(); var nx = $najax.get(null).timeout(5); var reflector = new Reflector(nx); reflector.type('html').render('#target', url); reflector.typeJson(function(v){ ... return v;}).render('#target', url); reflector.type('json').render('#target', url, null, function(v){ return this.list(v.list, function(k, v){ ... return v;}); }); Methods filter(fn) Set filter function. Parameters: Name Type Argument Description fn function &lt;optional&gt; Filter function. function(v:*){ return {string}; } Source: default/najax-class.static.js, line 633 Tutorials: najax-class Example reflector.filter(function(v){ ... return v;}); list(vs, fn) Create combined string by assoc and function. Parameters: Name Type Description vs array | assoc Array or Assoc values. fn function Filter function for single item. function(v:*){ return {string}; } Source: default/najax-class.static.js, line 653 Tutorials: najax-class Returns: Combined string. Type string Example reflector.filter(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); reflector.jsonType(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); nx(nx) Set and get Nx object. Parameters: Name Type Argument Description nx Nx &lt;optional&gt; Nx object. Source: default/najax-class.static.js, line 537 Tutorials: najax-class Returns: Type void | Nx Example var nx = $najax.get(null).retry(1); reflector.nx(nx); //Set vsr nx = reflector.nx(); //Get render(el, url, vs, filter) Ajax &amp; render to content. Parameters: Name Type Argument Description el string | Element Element or Element selector. url string URL. vs assoc &lt;optional&gt; URL parameter values. filter function &lt;optional&gt; Filter function. See Reflector.filter for detail. Source: default/najax-class.static.js, line 682 Tutorials: najax-class Returns: Relay object by Nx.done. Type Relay Example reflector.filter(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); reflector.jsonType(function(v){ return this.list(v.list){ return v.a + ', ' + v.b; } }); type(type, filter) Set type and filter function. Parameters: Name Type Argument Description type string Type. raw(default), text / html / json / any other Nx.type filter function &lt;optional&gt; Filter function. function(v:*){ return {string}; } Source: default/najax-class.static.js, line 565 Tutorials: najax-class Example reflector.type('html'); reflector.type('json'); reflector.type('raw'); reflector.type(null, function(v){ ... return v;}); reflector.type('json', function(v){ ... return v;}); typeHtml(filter) Set HTML type. Wrapper of type method. Parameters: Name Type Argument Description filter function &lt;optional&gt; Filter function. function(v:*){ return {string}; } Source: default/najax-class.static.js, line 612 Tutorials: najax-class Example reflector.typeHtml(); reflector.typeHtml(function(v){ ... return v;}); typeJson(filter) Set Json type. Wrapper of type method. Parameters: Name Type Argument Description filter function &lt;optional&gt; Filter function. function(v:*){ return {string}; } Source: default/najax-class.static.js, line 591 Tutorials: najax-class Example reflector.typeJson(); reflector.typeJson(function(v){ ... return v;}); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Relay.html":{"id":"Relay.html","title":"Class: Relay","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Relay Relay new Relay() Relay class. Provide 'Data-relay' and 'Abort', 'Bundle multiple Relay object by Linker'. Method Default ver Tiny ver All methods Yes Yes Source: relaylinker.static.js, line 34 Tutorials: relaylinker rlk-standalone See: Linker Example Relay = $najax.relayClass(); Relay = $rlk.relayClass(); //standalone Methods abort() Call abort. Source: relaylinker.static.js, line 303 See: Relay#abortCaller Returns: Type Relay Example rl.abort(fn); abortCaller(fn) Set abort function. It runs when calling abort. Parameters: Name Type Argument Description fn function &lt;optional&gt; Function. Source: relaylinker.static.js, line 172 See: Relay#abort Returns: Type Relay Example rl.abortCaller(fn); clear() Clear all values and related Relay object. Source: relaylinker.static.js, line 329 Example rl.clear(); data(w, v) Get and set original data. See example for detail. Parameters: Name Type Argument Description w string | assoc | null &lt;optional&gt; Name or assoc. v * &lt;optional&gt; Value. Source: relaylinker.static.js, line 234 Returns: Type * | assoc | void Example //Get all = rl.data(); //All values. v = rl.data('a'); //Specify name. //Set rl.data('a', 1); //By simple value. rl.data({'a': 1}); //By assoc. get(i) Get argument value or values. Parameters: Name Type Argument Default Description i number &lt;optional&gt; null Index. If null, all values. Source: relaylinker.static.js, line 192 Returns: Value. Type * Example v = rl.get(0); v = rl.get(1); vs = rl.get(); init() Initialize values and state. Source: relaylinker.static.js, line 63 Returns: Type Relay Example rl.init(); isActive() Is active. Source: relaylinker.static.js, line 286 Returns: Is active. Type boolean Example v = rl.isActive(); linker() Get related linker. Source: relaylinker.static.js, line 352 Returns: Related Linker object. Type Linker Example linker = rl.linker(); notifyFail(v) Notify fail with args. Parameters: Name Type Argument Description v * &lt;optional&gt; &lt;repeatable&gt; Passed argument values. Source: relaylinker.static.js, line 147 See: Relay#notifySuccess Returns: Type Relay Example rl.notifyFail(); rl.notifyFail(false, e); notifySuccess(v) Notify success with args. Parameters: Name Type Argument Description v * &lt;optional&gt; &lt;repeatable&gt; Passed argument values. Source: relaylinker.static.js, line 122 See: Relay#notifyFail Returns: Type Relay Example rl.notifySuccess(); rl.notifySuccess(true, e); setState(state, vs) Set state and passed args. State value type Value Description 1 Success -1 Fail -2 Abort Parameters: Name Type Argument Default Description state number &lt;optional&gt; null State. vs assoc &lt;optional&gt; null Argument values. Source: relaylinker.static.js, line 84 Returns: Type Relay Example rl.setState(1); //Success rl.setState(-1); //Fail rl.setState(-2); //Abort rl.setState(null, ags); //Set args. state() Get state. Source: relaylinker.static.js, line 269 Returns: State. Type number Example v = rl.state(); value() Get value of first argument. Source: relaylinker.static.js, line 216 Returns: Value. Type * Example v = rl.get(0); vs = rl.get(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"RESTful.html":{"id":"RESTful.html","title":"Class: RESTful","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: RESTful RESTful new RESTful() RESTful class. Source: default/najax-class.static.js, line 29 × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Singular.html":{"id":"Singular.html","title":"Class: Singular","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Singular Singular new Singular(caller, error) Singular class. Provide single-access. Method Default ver Tiny ver All methods Yes - Parameters: Name Type Argument Description caller function &lt;optional&gt; Caller function. error function &lt;optional&gt; Error function. Source: default/najax-class.static.js, line 105 Tutorials: najax-class demo-ui-ajax See: $najax@class.Singular Relay Example var Singular = $najax.Singular(); var singular = new Singular(); single.caller(function(){ ... return rl; }); //Set caller. single.kick(); //Begin. btn.onclick = single.kicker(); //Begin. Methods caller(fn) Set caller function. The caller function must returns Relay object. Function specificationfunction(any:*){ ... return {Relay}; } Parameters: Name Type Description fn function Caller function. function(any:*){ ... return {Relay}; } Source: default/najax-class.static.js, line 185 Tutorials: najax-class See: Relay Example singular.caller(fn); singular.caller(function(){ return $najax.request(url).done(function(data){ ... }); }); error(fn) Set error function. Parameters: Name Type Description fn function Error function. Source: default/najax-class.static.js, line 208 Tutorials: najax-class Example singular.error(fn); kick() Kick method for bind. Source: default/najax-class.static.js, line 139 Tutorials: najax-class Example singular.kick(); kicker() Return kick method for bind. this in kick method is Singular object. Source: default/najax-class.static.js, line 168 Tutorials: najax-class Returns: kick method. Type function Example btn.onclick = singular.kicker(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"Tx.html":{"id":"Tx.html","title":"Class: Tx","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global Class: Tx Tx new Tx(opt) Tx class. This class is created automatically by $najax.scriptTag and $najax.jsonpTag. Method Default ver Tiny ver All methods Yes - Specification Specify load and response behaviors by Nx object. Specify by Tx object's various method or Tx opt method. Begin tag-loading by Tx done. Tx done returns Relay object. Relay provide operating response-data, and bundling multiple Relay. Tx implement tag-loading by appending SCRIPT tag element. Parameters: Name Type Argument Description opt assoc &lt;optional&gt; Tx options. Properties Name Type Argument Default Description type string &lt;optional&gt; 'script' Response type. cache boolean &lt;optional&gt; false Enable cache. retry number &lt;optional&gt; null Retry number. noescape boolean &lt;optional&gt; false If true, not escape parameters. Apply to GET parameters. jsonp assoc &lt;optional&gt; Jsonp option. Properties Name Type Argument Default Description callback string | function &lt;optional&gt; '' Jsonp callback function. name string &lt;optional&gt; 'callback' Jsonp callback variable name. mime string &lt;optional&gt; 'text/javascript' Script tag's type. charset string &lt;optional&gt; null Script tag's charset. relaymode number &lt;optional&gt; $najax.define.relaymode Data relaymode. See $najax.define.relaymode for detail. clean boolean &lt;optional&gt; true Clear object's values after completed. Source: default/najax-core-tag.js, line 7 Tutorials: static-najax See: $najax.scriptTag $najax.jsonpTag Example $najax.scriptTag(url).done(); $najax.jsonpTag(url, 'func').done(); $najax.scriptTag(url).param('a', 1).param('b', 1).done(); $najax.jsonpTag(url).jsonp('func').done(); $najax.scriptTag(url).opt({charset: 'utf-8'}).done(); $najax.scriptTag(url).complete(function(){ ... }).done(); $najax.scriptTag(url).fail(function(){ ... }).done(); Methods abort() Abort ajax. Source: default/najax-core-tag.js, line 466 Tutorials: static-najax Returns: Type Tx Example tx.abort(); begin(fn) Set begin function. Function specificationCalled before beginning tag-loading. Function structurefunction(){ ... } this: Relay object Parameters: Name Type Description fn function Begin function. Source: default/najax-core-tag.js, line 269 Tutorials: static-najax See: Tx#success Tx#fail Tx#complete Tx#running Tx#done Returns: Type Tx Example $najax.scriptTag(url).begin(function(){ ... }).done(); cache(on) Set cache behavior. Parameters: Name Type Description on boolean Determine to cache. Default Value: false Source: default/najax-core-tag.js, line 118 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).cache(true).done(); charset(v) Set charset value of script-tag. Parameters: Name Type Description v string Charset. Default Value: null Source: default/najax-core-tag.js, line 188 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).charset('utf-8').done(); clean(on) Set clear behavior. Parameters: Name Type Description on boolean Determine to clear. If true, clear object's values after completed. Default Value: true Source: default/najax-core-tag.js, line 213 Tutorials: static-najax See: Nx#clear Returns: Type Tx Example var tx = $najax.scriptTag(url).clean(false);tx.done(); clear() Clear object's values after completed. Source: default/najax-core-tag.js, line 486 Tutorials: static-najax Example tx.clear(); complete(fn) Set complete function. Function specificationCalled after ajax completed, both success and fail. Function structurefunction(){ ... } this: Relay object Parameters: Name Type Description fn function Complete function. Source: default/najax-core-tag.js, line 356 Tutorials: static-najax See: Tx#begin Tx#success Tx#fail Tx#running Tx#done Returns: Type Tx Example $najax.scriptTag(url).complete(function(){ ... }).done(); done(success, fail, complete) Set success / fail / complete, and begin tag-loading. Parameters: Name Type Argument Description success function &lt;optional&gt; Success function. See Tx.success. fail function &lt;optional&gt; Fail function. See Tx.fail. complete function &lt;optional&gt; Complete function. See Tx.complete. Source: default/najax-core-tag.js, line 438 Tutorials: static-najax See: Tx#begin Tx#success Tx#fail Tx#complete Tx#running Returns: Relay object. Type Relay Example $najax.scriptTag(url).done(); $najax.scriptTag(url).done(function{ ... }); $najax.jsonpTag(url, 'func').done(null, function{ ... }); $najax.jsonpTag(url, 'func').done(null, null, function{ ... }); fail(fn) Set fail function. Function specificationCalled when tag-loading fail. ex: network error, 403, 404, 503 or any other HTTP error. Function structurefunction(){ ... } this: Relay object Parameters: Name Type Description fn function Fail function. Source: default/najax-core-tag.js, line 327 Tutorials: static-najax See: Tx#begin Tx#success Tx#complete Tx#running Tx#done Returns: Type Tx Example $najax.scriptTag(url).fail(function(){ ... }).done(); jsonp(callback, name) Set jsonp option. Parameters: Name Type Argument Default Description callback string | function &lt;optional&gt; Jsonp callback function. name string &lt;optional&gt; 'callback' Jsonp callback variable name. Source: default/najax-core-tag.js, line 154 Tutorials: static-najax Returns: Type Tx Example $najax.jsonpTag(url).jsonp('func').done(); $najax.jsonpTag(url).jsonp(func).done(); $najax.jsonpTag(url).jsonp(func, 'callback').done(); mime(v) Set type value of script-tag. Parameters: Name Type Description v string Type. Default Value: 'text/javascript' Source: default/najax-core-tag.js, line 208 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).mime('application/javascript').done(); opt(w, v) Set opt value. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: default/najax-core-tag.js, line 250 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).opt('noescape', true).done(); $najax.scriptTag(url).opt('relaymode', 1).done(); $najax.scriptTag(url).opt({charset: 'utf-8'}).done(); param(w, v) Set param. GET parameters. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: default/najax-core-tag.js, line 100 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).param('a', 1).param('b', 1).done(); $najax.scriptTag(url).param({a: 1, b:2, c:3}).done(); relay(w, v) Set relay original data. Parameters: Name Type Argument Description w string | assoc Name or assoc. v string &lt;optional&gt; Value. Source: default/najax-core-tag.js, line 232 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).relay('a', 1).relay('b', 2).done(); $najax.scriptTag(url).relay({a:1, b:2}).done(); retry(n) Set retry number. Parameters: Name Type Description n number Retry number. Default Value: null Source: default/najax-core-tag.js, line 136 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(url).retry(2).done(); running(fn) Set running function. Function specificationCalled when begin(state=true) and complete(state=false). Function structurefunction(state:boolean){ ... } this: Relay object Parameters: Name Type Description fn function Running function. Source: default/najax-core-tag.js, line 385 Tutorials: static-najax See: Tx#begin Tx#success Tx#fail Tx#complete Tx#done Returns: Type Tx Example $najax.scriptTag(url).running(function(state){ ... }).done(); success(fn) Set success function. Function specificationCalled when tag-loading succeed. ex: HTTP code 200. Function structurefunction(){ ... } this: Relay object Parameters: Name Type Description fn function Success function. Source: default/najax-core-tag.js, line 298 Tutorials: static-najax See: Tx#begin Tx#fail Tx#complete Tx#running Tx#done Returns: Type Tx Example $najax.scriptTag(url).success(function(){ ... }).done(); url(url) Set url. Parameters: Name Type Description url string URL. Source: default/najax-core-tag.js, line 84 Tutorials: static-najax Returns: Type Tx Example $najax.scriptTag(null).url(url).done(); × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-demo-ui-ajax.html":{"id":"tutorial-demo-ui-ajax.html","title":"Tutorial: demo-ui-ajax","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global demo-ui-ajax Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-najax-class.html":{"id":"tutorial-najax-class.html","title":"Tutorial: najax-class","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global najax-class Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-najax-ex.html":{"id":"tutorial-najax-ex.html","title":"Tutorial: najax-ex","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global najax-ex Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-najax-helper.html":{"id":"tutorial-najax-helper.html","title":"Tutorial: najax-helper","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global najax-helper Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-najax-read.html":{"id":"tutorial-najax-read.html","title":"Tutorial: najax-read","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global najax-read Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-relaylinker.html":{"id":"tutorial-relaylinker.html","title":"Tutorial: relaylinker","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global relaylinker Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-rlk-standalone.html":{"id":"tutorial-rlk-standalone.html","title":"Tutorial: rlk-standalone","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global rlk-standalone Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-static-history.html":{"id":"tutorial-static-history.html","title":"Tutorial: static-history","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global static-history Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-static-najax-micro.html":{"id":"tutorial-static-najax-micro.html","title":"Tutorial: static-najax-micro","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global static-najax-micro Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "},"tutorial-static-najax.html":{"id":"tutorial-static-najax.html","title":"Tutorial: static-najax","body":" najaxjs Namespaces $najax$najax.define$najax.history$najax@class$najax@ex$najax@helper$najax@read$najax@rlk Classes LinkerNxPagerReflectorRelayRESTfulSingularTx Tutorials demo-ui-ajaxnajax-classnajax-exnajax-helpernajax-readrelaylinkerrlk-standalonestatic-historystatic-najax-microstatic-najax Global Global static-najax Demo is iframe content. Standalone demo is here. Require php activation in server. × Search results Close Documentation generated by JSDoc 3.4.0 using the DocStrap template. "}}
    </script>

    <script type="text/javascript">
        $(document).ready(function() {
            Searcher.init();
        });

        $(window).on("message", function(msg) {
            var msgData = msg.originalEvent.data;

            if (msgData.msgid != "docstrap.quicksearch.start") {
                return;
            }

            var results = Searcher.search(msgData.searchTerms);

            window.parent.postMessage({"results": results, "msgid": "docstrap.quicksearch.done"}, "*");
        });
    </script>
</body>
</html>
